I've been trying to find out why the script that i made only works in "Script", but not in "LocalScript" Here's the code in case you were wondering.

wait(5)
local player = game.Players.LocalPlayer
function newPlayer(nP)
	m = Instance.new("Message")
	h = Instance.new("Hint")
	h.Parent = game.Workspace
	h.Name = "gtfo"
	h.Text = "Hello, friend."
	wait(4)
	h.Text = "We haven't seen each other for a while, ".. game.Players.LocalPlayer.Name .."."
	wait(10)
	h.Text = "You might remember me as Z'Ralk'Thalat."
	wait(5)
	h.Text = "B U T"
	wait(2)
	h.Text = "T H A T"
	wait(2)
	h.Text = "I S"
	wait(2)
	h.Text = "N O T"
	wait(2)
	h.Text = "M Y"
	wait(2)
	h.Text = "N A M E"
	wait(1)
	game.Workspace.gtfo:remove()
	m.Parent = game.Workspace
	m.Text = "Loading [QWRTB()T]"
	wait(5)
	m.Text = "Loaded!"
	wait(2)
	game.Workspace.Message:remove()
	S = game.Workspace:FindFirstChild("Humanoid",true)
	if S then
	S.Health = 0
end
	h.Parent = game.Workspace
	h.Text = "[QWRTB()T] PERMISSIONS LEVEL: 9"
	wait(3)
	h.Text = "[QWRTB()T]: AbFGrNy has requested to ban ".. game.Players.LocalPlayer.Name .."."
	wait(5)
	h.Text = "There are ".. game.Workspace.Votes.Value .." Votes."
	for i = 0, 19 do
		wait(0.5)
		game.Workspace.Votes.Value = game.Workspace.Votes.Value + 1
		h.Text = "[QWRTB()T]: There are ".. game.Workspace.Votes.Value .." Votes."
	end
	S = game.Workspace:FindFirstChild("Humanoid",true)
	wait(1)
	S:remove()
	wait(1)
	h.Text = "[QWRTB()T]: ".. game.Players.LocalPlayer.Name .." Has been banned."
	game.Players.LocalPlayer:remove()
end

game.Players.PlayerAdded:connect(newPlayer)

1 comment

0

because you are trying to do this for playersAdded, you are confusing your self by trying to add a new player. Therefore, the paramater that you passed in the function, is in fact the player that has been added, not the other local variable that you created and named as player. another thing is that you keep constantly setting S to the same value, which does nothing at all. And game.Players.Local