Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Local Force Sit Script Singleplayer?

Trying to make a force sit script for a single player game once the player has joined. I have tried using a server script aswell, and the "done" does not print, no error seems to be shown.. is this my fault, or is this method non-existant?

game.Players.PlayerAdded:Connect(function(plrn)
	local holder = plrn.Name
	wait(1)
	script.Parent:Sit(game.Workspace[holder].Character:WaitForChild('Humanoid'))
	print('done')
end)

2 answers

You tried to get the character.... of a character.

"game.Workspace[holder].Character"

Remove the .Character and see if it works.

Here's how you could do this with a local script:

local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")

hum.Sit = true

But if you wanted to do it with a server script (which I recommend, even in a single player server):

game.Players.PlayerAdded:Connect(function(plyr)
	plyr.CharacterAdded:Connect(function(char)
		local hum = char:WaitForChild("Humanoid")
		wait(1)
		hum.Sit = true
	end)
end)

I noticed whenever testing these scripts, the sitting animation had yet to load, and would not load afterwards.

This discussion is preserved as it was. New answers, comments, and votes are closed.