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

(Answered) How do i make a script to run another when i'm in a seat?

Ok, so i'm new to scripting. i have a friend that's a bit better, but still can't resolve this issue. I'm trying to make something to the likes of a plane script. I've gone through 10 iterations of this, but here's one a friend sent me.


game.Players.PlayerAdded:Connect(function(Player)
    Player.CharacterAdded:Connect(function()
            while wait(1) do
            print(Player.Character.Humanoid.SeatPart)
            end
        if Player.Character.Humanoid.SeatPart then
            print("works omg")
        end
    end)

He says this iterations gets no output error, but doesn't work. Unlike all the past iterations, which got an output error, and didn't work. I've figured out the movement stuff, just not this. Please let me know if you have an answer since i don't want to abandon my game idea.

1 answer

Your script has a few flaws.

For starters, you are never actually running the "if Player.Character.Humanoid.SeatPart then" as it's not inside the while wait(1) do.

Secondly, you don't have another end) which you would need.

The below is a version of your script that would fully work. I believe it is what you want.

game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function()
		while true do
			wait(1)
			print(Player.Character.Humanoid.SeatPart)
			if Player.Character.Humanoid.SeatPart ~= nil then
				print("works omg")
			end
		end
	end)
end)

2 comments

0

thanks, i'll get to testing this. (edit: It works!) yay!

0

Mark it as accepted if it works

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