You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in Roblox Studio, i made a game, i got a boat model which its script was all f#cked up, and i have that boat model that contains a BodyVelocity, which for those who don't know, its like a thing that sets some specific propertys, like the Speed of the boat and the property called "Velocity" which make that, is a Vector3 as well, so like, i can't change some Values of it with some basic operations like aritmetic, atleast not directly, multiplication and divisions still work, but they are, like, "sequencial" based operations, so, if put like x * y it will return to me a x value multiplied by a n quantity of y, but i really can't do no thing with that value returned by that multiplication, and i will explain the value that i need,
!!! --- FIRST --- !!!
X NEEDS TO BE EQUAL TO Y(n)
!!! --- BUT --- !!!
FOR X TO REACH Y VALUE, IT DOES'T NEED TO STORE THE RESULT VALUE ITSELF
!!! --- INSTEAD --- !!!
IT NEEDS TO STORE THE SEQUENCE OF VALUES IN ON INTEGER
!!! --- AND --- !!!
IT CAN NOT BE A DATATABLE
It's either a "sequencial" integer or it won't work, somehow, the thing that it needs to alter the "Velocity" its a sequencial type of operation that doesn't use any aritmetic and in only one integer
!!! --- CODE EXAMPLE --- !!!
For better understanding, a example goes like this. I have a boat model a Roblox Studio Baseplate, the boat got a "VehicleSeat" and 3 Boolean values, which are "Driving" -- Default = false -- "Left" -- Default = false -- "Right" -- Default = false --, that all goes inside the model, inside the VehicleSeat will have a script(The one we will be using for the example), as well a BodyGyro, BodyPostion and the body Velocity inside it, the rest of the model itself doesn't matter much, as the following script makes the whole boat model move
{ 1 . if script.Parent.Throttle == 1 then
2 . if value1 < MaxSpeed then value1 = value1+1 end
3 . script.Parent.Parent.Driving.Value = true
4 . script.Parent.BodyVelocity.Velocity = script.Parent.CFrame.lookVector*value1
5 . script.Parent.Parent.Left.Value = false
6 . script.Parent.Parent.Right.Value = false
end } ------- > Explanation:
1 --- After the VehicleSeat Throttle property value is set to 1, the script will verify if thats true with this "if script.Parent.Throttle == 1 then".
2 --- After the VehicleSeat Throttle property value is verified, there will be an action if the value set to it is equal to one, which is verifying
another thing, that thing is if the value1 local is smaller than the MaxSpeed local, "if value1 < MaxSpeed...", if thats true then another action will
happen, which is changing the value1 local's value to 1, "...then value1 = value1+1 end", that value will be further used.
3 --- After all this, theres an actual "extra" script, that works with the 3 Booleans(Driving, Left and Right) and their values, but there's not much
to be done with it, as it just identifies if the player is driving the boat, and as well it identifies if the player is going to the left or to right.
So, line 3 just sets the Driving value to true "script.Parent.Parent.Driving.Value = true"
4 --- Now this is the problem, the following line "script.Parent.BodyVelocity.Velocity = script.Parent.CFrame.lookVectorvalue1" causes the problem
with the script, i'm not very sure if there any other options but if possible and someones knows please tell me, so this is the problem, here in
"...script.Parent.CFrame.lookVectorvalue1" there is this one operation "...lookVector" which is CFrame, multiplied by the local value1, the code
in Roblox Studio does not support any Aritmetics(Atleast i think it doesn't because of an error shown in the output) operations between Cframes
and numbers, Cframes contain integers that determine 3D Positions on any Roblox game, so if you change for an example, a Part's position value,
which is 1, by one, it will change its position as well in the Roblox game, but in my case, the thing is that the velocity, is CFrame like
thing that changes the postion of things as well, and it can increase its "Changing position" value but only by sequencial operations, and that
f#cked up all i was doing with my boat, because i needed to make a function, which with time, the Speed would change its "Changing position" value
to a lower value, after the Throttle has been set to 0, but it just sets the Changing position value into 0 directly, so if the player stops the boat,
Automaticaly it will not move, making kindly ugly and the movement would just not be smooth as it should be.
if script.Parent.Throttle == 0 then
value1 = 0
script.Parent.Parent.Driving.Value = false
script.Parent.BodyVelocity.Velocity = script.Parent.CFrame.lookVectorvalue1
script.Parent.Parent.Left.Value = false
script.Parent.Parent.Right.Value = false
end
if script.Parent.Throttle == -1 then
if value1 < maxspeed then value1 = value1+1 end
script.Parent.Parent.Driving.Value = true
script.Parent.BodyVelocity.Velocity = script.Parent.CFrame.lookVector-value1
script.Parent.Parent.Left.Value = false
script.Parent.Parent.Right.Value = false
end
if script.Parent.Steer == 1 then
script.Parent.BodyGyro.cframe = script.Parent.BodyGyro.cframe * CFrame.fromEulerAnglesXYZ(0,-.01,0)
script.Parent.Parent.Driving.Value = true
script.Parent.Parent.Right.Value = true
script.Parent.Parent.Left.Value = false
end
if script.Parent.Steer == -1 then
script.Parent.BodyGyro.cframe = script.Parent.BodyGyro.cframe * CFrame.fromEulerAnglesXYZ(0,.01,0)
script.Parent.Parent.Driving.Value = true
script.Parent.Parent.Left.Value = true
script.Parent.Parent.Right.Value = false
end
end
--- PROBLEM ---
If you read all things up, you will know what the real problem is, this is just a little recap,
So the player goes into the VehicleChair, moves the boat, and when its stops, automatically, the
"Changing Position" value goes to 0, and i dont want that.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
in Roblox Studio, i made a game, i got a boat model which its script was all f#cked up, and i have that boat model that contains a BodyVelocity, which for those who don't know, its like a thing that sets some specific propertys, like the Speed of the boat and the property called "Velocity" which make that, is a Vector3 as well, so like, i can't change some Values of it with some basic operations like aritmetic, atleast not directly, multiplication and divisions still work, but they are, like, "sequencial" based operations, so, if put like x * y it will return to me a x value multiplied by a n quantity of y, but i really can't do no thing with that value returned by that multiplication, and i will explain the value that i need,
!!! --- FIRST --- !!!
X NEEDS TO BE EQUAL TO Y(n)
!!! --- BUT --- !!!
FOR X TO REACH Y VALUE, IT DOES'T NEED TO STORE THE RESULT VALUE ITSELF
!!! --- INSTEAD --- !!!
IT NEEDS TO STORE THE SEQUENCE OF VALUES IN ON INTEGER
!!! --- AND --- !!!
IT CAN NOT BE A DATATABLE
It's either a "sequencial" integer or it won't work, somehow, the thing that it needs to alter the "Velocity" its a sequencial type of operation that doesn't use any aritmetic and in only one integer
!!! --- CODE EXAMPLE --- !!!
For better understanding, a example goes like this. I have a boat model a Roblox Studio Baseplate, the boat got a "VehicleSeat" and 3 Boolean values, which are "Driving" -- Default = false -- "Left" -- Default = false -- "Right" -- Default = false --, that all goes inside the model, inside the VehicleSeat will have a script(The one we will be using for the example), as well a BodyGyro, BodyPostion and the body Velocity inside it, the rest of the model itself doesn't matter much, as the following script makes the whole boat model move
|--------------------------------------------------------------------------------------------------|
--- SCRIPT ---
local MaxSpeed = 50
local StartingSpeed = 0
local value1 = 0
while true do
{ 1 . if script.Parent.Throttle == 1 then
2 . if value1 < MaxSpeed then value1 = value1+1 end
3 . script.Parent.Parent.Driving.Value = true
4 . script.Parent.BodyVelocity.Velocity = script.Parent.CFrame.lookVector*value1
5 . script.Parent.Parent.Left.Value = false
6 . script.Parent.Parent.Right.Value = false
end } ------- > Explanation:
1 --- After the VehicleSeat Throttle property value is set to 1, the script will verify if thats true with this "if script.Parent.Throttle == 1 then".
2 --- After the VehicleSeat Throttle property value is verified, there will be an action if the value set to it is equal to one, which is verifying
another thing, that thing is if the value1 local is smaller than the MaxSpeed local, "if value1 < MaxSpeed...", if thats true then another action will
happen, which is changing the value1 local's value to 1, "...then value1 = value1+1 end", that value will be further used.
3 --- After all this, theres an actual "extra" script, that works with the 3 Booleans(Driving, Left and Right) and their values, but there's not much
to be done with it, as it just identifies if the player is driving the boat, and as well it identifies if the player is going to the left or to right.
So, line 3 just sets the Driving value to true "script.Parent.Parent.Driving.Value = true"
4 --- Now this is the problem, the following line "script.Parent.BodyVelocity.Velocity = script.Parent.CFrame.lookVectorvalue1" causes the problem
with the script, i'm not very sure if there any other options but if possible and someones knows please tell me, so this is the problem, here in
"...script.Parent.CFrame.lookVectorvalue1" there is this one operation "...lookVector" which is CFrame, multiplied by the local value1, the code
in Roblox Studio does not support any Aritmetics(Atleast i think it doesn't because of an error shown in the output) operations between Cframes
and numbers, Cframes contain integers that determine 3D Positions on any Roblox game, so if you change for an example, a Part's position value,
which is 1, by one, it will change its position as well in the Roblox game, but in my case, the thing is that the velocity, is CFrame like
thing that changes the postion of things as well, and it can increase its "Changing position" value but only by sequencial operations, and that
f#cked up all i was doing with my boat, because i needed to make a function, which with time, the Speed would change its "Changing position" value
to a lower value, after the Throttle has been set to 0, but it just sets the Changing position value into 0 directly, so if the player stops the boat,
Automaticaly it will not move, making kindly ugly and the movement would just not be smooth as it should be.
if script.Parent.Throttle == 0 then
value1 = 0
script.Parent.Parent.Driving.Value = false
script.Parent.BodyVelocity.Velocity = script.Parent.CFrame.lookVectorvalue1
script.Parent.Parent.Left.Value = false
script.Parent.Parent.Right.Value = false
end
if script.Parent.Throttle == -1 then
if value1 < maxspeed then value1 = value1+1 end
script.Parent.Parent.Driving.Value = true
script.Parent.BodyVelocity.Velocity = script.Parent.CFrame.lookVector-value1
script.Parent.Parent.Left.Value = false
script.Parent.Parent.Right.Value = false
end
if script.Parent.Steer == 1 then
script.Parent.BodyGyro.cframe = script.Parent.BodyGyro.cframe * CFrame.fromEulerAnglesXYZ(0,-.01,0)
script.Parent.Parent.Driving.Value = true
script.Parent.Parent.Right.Value = true
script.Parent.Parent.Left.Value = false
end
if script.Parent.Steer == -1 then
script.Parent.BodyGyro.cframe = script.Parent.BodyGyro.cframe * CFrame.fromEulerAnglesXYZ(0,.01,0)
script.Parent.Parent.Driving.Value = true
script.Parent.Parent.Left.Value = true
script.Parent.Parent.Right.Value = false
end
--- PROBLEM ---
If you read all things up, you will know what the real problem is, this is just a little recap,
So the player goes into the VehicleChair, moves the boat, and when its stops, automatically, the
"Changing Position" value goes to 0, and i dont want that.
|--------------------------------------------------------------------------------------------------|
--- SOLUTION ---
If you know how to help me please say it to me.
USE THE SCRIPT AND COMMENT WITH THE PROPER SOLUTION ORCHANGE THE SCRIPT IN THE TEXT FILE
helpmepls.txt
Beta Was this translation helpful? Give feedback.
All reactions