alright, i have a problem with platform moving script, i have 16 platforms in a circle inside a folder, and the script is supposed to rotate them, and i want the player to kind of stick onto the platform if you know.
i never knew how to do that, but i tried to do with bodyposition (i have no idea how to use bodyposition since i never did), and it doesnt stick the player to it, the part is a server script,
local speed = game.ReplicatedStorage.Difficulty.Value / 35
local center = script.Parent.Point
for _, platform in pairs(script.Parent.Parent:GetChildren()) do
if platform.Name ~= "Map" then
repeat wait() until platform:FindFirstChild("Part")
local BP = Instance.new("BodyPosition")
BP.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
BP.Parent = platform.Part
BP.P = 1000
BP.D = 100
local offset = platform.Part.Position - center.Position
local initialAngle = math.deg(math.atan2(offset.Z, offset.X))
coroutine.wrap(function()
while true do
for angle = 0, 360, speed do
local radians = math.rad(initialAngle + angle)
local x = center.Position.X + offset.magnitude * math.cos(radians)
local z = center.Position.Z + offset.magnitude * math.sin(radians)
BP.Position = Vector3.new(x, platform.Part.Position.Y, z)
platform.Part.Position = Vector3.new(x, platform.Part.Position.Y, z)
local lookVector = (center.Position - platform.Part.Position).unit
platform.Part.CFrame = CFrame.lookAt(platform.Part.Position, platform.Part.Position + lookVector, Vector3.new(0, 1, 0))
wait(0.01)
end
end
end)()
end
end
Thanks!