#how to make a platform move
1 messages · Page 1 of 1 (latest)
tweenservices
Make it anchored false and can collide true in properties
local platform = script.Parent
local speed = 5
local range = 20
local direction = 1
local startPos = platform.Position
game:GetService("RunService").Heartbeat:Connect(function(dt)
local offset = Vector3.new(speed * direction * dt, 0, 0)
platform.Position = platform.Position + offset
if (platform.Position - startPos).Magnitude >= range then
direction = -direction
end
end)
Put this script and see if it works
Put this script inside of the part u want to move
But if u want the player to be able to stand on it then…
Make anchored true
Anchored false*
Can collide true
Massless true
Make sure the part is in a model
Copy this!
** You are now Level 2! **
local platform = script.Parent
local speed = 5 -- studs per second
local range = 20 -- how far it moves before turning around
local direction = 1
local startPos = platform.PrimaryPart.Position
game:GetService("RunService").Heartbeat:Connect(function(dt)
local offset = Vector3.new(speed * direction * dt, 0, 0)
platform:SetPrimaryPartCFrame(platform:GetPrimaryPartCFrame() + offset)
if (platform.PrimaryPart.Position - startPos).Magnitude >= range then
direction = -direction
end
end)
If it doesn’t work then idk
real
before using the script i suggest you understand whats going on in it
it will help you in the future and you'll get new knowledges
Yes
Learn anything before giving shitty ai advice
just use tweens bro
yeah
tween would be the best instead of having to use runservice.
since it only requires a few code to make it move
Ig yes