Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make players stay on spining platforms? ( answered )

Asked by 5 years ago
Edited 4 years ago

After doing some research I found the most efficient way of doing this is with cylinder constraints. here is a free model which you can use in your games and play with which shows off a platform which keeps players on it. ( This platform actually uses no scripts so that's why there is none listed )

https://web.roblox.com/library/4991184804/Advanced-Spining-platform

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Well this was fun (and amusing) to work on, and it may be a little cheaty but it works!

Here ya go:

local Spin_Part =script.Parent--The part
local Spin_Pos =Spin_Part.Position
local Can =true

local function Rotate(State,Hit_Model)
    while Hit_Model.Humanoid.Jump ==false do--You jump (hold jump) to get off. A bit jumpy but it works, so...
        wait()
        Hit_Model:SetPrimaryPartCFrame(Spin_Part.CFrame)--RoTaTe!
    end
    Hit_Model.PrimaryPart =Hit_Model.HumanoidRootPart
    Hit_Model.RoPart:Destroy()
    wait(0.2)--Attempt #2 to stop "floating"
    Can =true
end

Spin_Part.Touched:connect(function(hit)
    if Can ==true and hit.Parent:IsA("Model")and hit.Parent:FindFirstChild("HumanoidRootPart")and hit.Parent:FindFirstChild("Humanoid")and not hit.Parent:FindFirstChild("RoPart")then
        Can =false
        local RotatePart =Instance.new("Part")
        RotatePart.Name ="RoPart"
        RotatePart.Size =Vector3.new(0,0,0)
        RotatePart.Transparency =1
        RotatePart.Anchored =true
        RotatePart.CanCollide =false
        RotatePart.Locked =true
        RotatePart.CFrame =Spin_Part.CFrame
        RotatePart.Parent =hit.Parent
        hit.Parent.PrimaryPart =RotatePart
        repeat wait()until hit.Parent.Humanoid.FloorMaterial ~=nil--Attempt #1 to stop "floating"
        Rotate(true,hit.Parent)
    end
end)

while true do--Your rotate script. Doesn't need to be here, it just is.
    wait()
    Spin_Part.CFrame =Spin_Part.CFrame*CFrame.fromEulerAnglesXYZ(0,0.05,0)
end

Just put this script alone into your part, and it'll take care of the rest. No editing is needed for part positions, It will adapt to the part you put it in!

I'm not sure if it'll work with more then one player, but it will work with anything containing a part named "HumanoidRootPart" and a Humanoid! (inside a Model)

So you can rotate custom made boxes and stuff.

Enjoy!

remember to mark this as the solution if it works

0
Thanks that helps a lot not exactlly what I had in mind but works just fine... If there is two players then only the first player is connected to the script and the other doesn't it shouldn't be a big issue though robloxian_colby 22 — 5y
0
Ya, I didn't make it to work with more then one player, but I'm glad it was able to get you on the right track. mbramblet 80 — 5y
0
Just wondering would it be possible to make the primary part for the player on the same rotaion pattren as the platfrom so players can move around with the primary part inside them connecting them to the location of the platform? robloxian_colby 22 — 5y
0
That's what I tried to do, but the closest I got in the amount of time I had was what I shared above. I might be able to find a better way with more time, but I don't have any rightnow. Sorry. I'll look into it again sometime later if I can. mbramblet 80 — 5y
0
ok I'll try and figure it out myself don't have much faith in my abbility but I can always try also thanks for all your help robloxian_colby 22 — 5y
Ad

Answer this question