Im working on a game where the player spawns in first person and is sitting in a chair unable to move but im fairly new to coding thus i dont really know how to make that work
how would i go about writing this kind of script that would spawn the player sitting on the seat and doesnt effect the character being in first person
ive even tried putting the spawn right under the chair so it sits as its loading in but that also causes some problems like the character standing on the chair when it loads in or being stuck inside the chair
ive tried looking at posts by other ppl asking a similar question but for some reason the scripts either didnt work or were outdated
just a heads up the character will be locked in first person when they spawn if that helps
You can put this code into a server script inside the seat:
local players = game:GetService('Players')
players.PlayerAdded:Connect(function(player)
local added
added = player.CharacterAdded:Connect(function(character)
added:Disconnect()
task.wait(0.1)
local humanoid = character:WaitForChild('Humanoid')
humanoid.JumpPower = 0
while not humanoid.Sit do
character:WaitForChild('HumanoidRootPart').CFrame = script.Parent.CFrame
task.wait()
end
end)
end)
To let the player jump again, set their JumpPower to 50 (default) or anything else you want as long as it’s above 0.