When I was testing my game, I tried doing an obby and whenever I would jump onto like a cloud or fall onto a cloud, it would just teleport the player somewhere else but not teleport them on the cloud. I believe this is the script that’s causing it?
local RunService = game:GetService("RunService")
local Character = script.Parent
local RootPart = Character:WaitForChild("Head")
local LastTrainCFrame, Connection
local Params = RaycastParams.new()
Params.FilterType = Enum.RaycastFilterType.Exclude
Params.FilterDescendantsInstances = {Character}
local stickyParts = {
CloudPlatform = true,
--AnotherName = true,
}
RunService.Heartbeat:Connect(function()
local result = workspace:Raycast(RootPart.Position, -Vector3.yAxis*50, Params)
local target = result and result.Instance
if target and stickyParts[target.Name] then
local TrainCF = target.CFrame
if LastTrainCFrame == nil then -- If no LastTrainCFrame exists, make one!
LastTrainCFrame = TrainCF -- This is updated later.
end
local Rel = TrainCF * LastTrainCFrame:Inverse()
LastTrainCFrame = TrainCF -- Updated here.
RootPart.CFrame = Rel * RootPart.CFrame -- Set the player's CFrame
else
LastTrainCFrame = nil -- Clear the value when the player gets off.
end
end)
robloxapp-20250313-1747140.wmv (4.3 MB)
I don’t know if the video quality may be good but I don’t have any video recording software so I just used roblox’s video recording.
Well, it is a free model but I added a platform for the player to stand on also the script didn’t come with it. Previously, I wanted the player’s character model to move along with the move cloud at the start but it didn’t work and this script was apparently the solution to it but now it has caused another problem. (The local script is located in startercharacterscripts)
I want them to move with the moving cloud (at the start) that was moving but I didn’t know it would teleport them randomly when they fell to a cloud or jumped up to a cloud.
The script kind of solved the problem but I discovered that when a player’s falls to a cloud or jumps to the cloud near the center, it would just randomly teleport them idk why it does that?
Since i can’t really access studio right now, you’ll probably have to make it yourself, but that prob won’t be too complicated, it’s quite easy to find solutions by looking things up and digging for a bit.
Here’s another post i found with a script that you’ll be able to adapt to your cloud if you know a minimum of scripting.
I’m guessing you were CFrame moving the cloud? That won’t work to move players unless you update the players CFrame every frame.
You could use a Constraint to move the cloud. If it’s a straight line just use a PrismaticConstraint. Since constraints are physics based players are affected by them.
No no. The script does move the player on the moving cloud. It’s the middle part of the obby, where when the players fall to another cloud or jump onto that cloud, they player will teleport off (It’s not moving just anchored there)
Ah, k.
But if you were using PrismaticConstraints to move the clouds it wouldn’t cause that.
It sounds like when the player is already touching a cloud the CFrame is being updated properly, but when they drop off their CFrame is being miscalculated.
The script should be reading the player’s CFrame as soon as it lands on (touches) a cloud, then start controlling their movement from that location.