#Block Player Walking and Jumping

1 messages · Page 1 of 1 (latest)

dreamy minnow
#

So... Basically, the context of my problem is that the players are in the lobby and when they are teleported to their seats, their movement is also blocked. They can't walk or jump. Actually, that's how it should be, but when they are teleported, they can still jump, regardless of what I do. I just want the player to stay still in their seat... how should I solve this?

local function teleportAndFreeze()

    local allPlayers = Players:GetPlayers()
    local seats = SeatsFolder:GetChildren()
    local seatIndex = 1

    for _,p in ipairs(allPlayers) do
        local char = p.Character
        if char and char:FindFirstChild("HumanoidRootPart") and char:FindFirstChild("Humanoid") then
            local hum = char.Humanoid
            local role = p:GetAttribute("Role")

            hum.Sit = false

            local tempSeat = Instance.new("Seat")
            tempSeat.Anchored = true
            tempSeat.CanCollide = false
            tempSeat.Transparency = 1
            tempSeat.CFrame = (role=="Narrador") and (NarratorSeat.CFrame + Vector3.new(0,3,0)) or (seats[seatIndex].CFrame + Vector3.new(0,3,0))
            tempSeat.Parent = Workspace

            if char:FindFirstChild("HumanoidRootPart") then
                char.HumanoidRootPart.CFrame = tempSeat.CFrame
            end
            hum.Sit = true
            hum.WalkSpeed = 0
            hum.JumpPower = 0
            hum.PlatformStand = false

            p:SetAttribute("TempSeat", tempSeat)

            if role ~= "Narrador" then
                seatIndex = seatIndex + 1
                if seatIndex > #seats then seatIndex = 1 end
            end
        end
    end
torn breach
#

maybe a stupid question but is the game using jump power in settings?

mild heart
#

disable the player controls

torn breach
#

also you should probably use hum:SetStateEnabled(Enum.HumanoidStateType.Jumping, false) over jump power, or at least that’s what I prefer

#

only on client tho so use a remote

mild heart
#

why not anchor the player in place

torn breach
#

right i forgot about anchor use that

dreamy minnow
#

wait, I'll test it and then I'll tell if it worked

torn breach
#

How’d it go

dreamy minnow
#

actually im almost there but now my player is floating

mild heart
#

send ur code

torn breach
#

seat is probably floating cus the + vector3.new(0,3,0)

#

try without the vector3 if it does need it make it a bit less

mild heart
#

is that how u set cframe there is and

#

ipairs is unneeded u can remove it

#

for _, p in allPlayers do

dreamy minnow
fluid domeBOT
#

studio** You are now Level 1! **studio