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

Why wont this Work?

Help im trying to make this give admins more health on my game but line 2 is braking the whole script! its also a player has entered the game script but line 2 is the only thing going wrong! Please Help!

function onPlayerEntered()
	local humanoid = player.Character:findFirstChild("Humanoid")
	local message = Instance.new("Message")
	message.Parent = game.Workspace
	if player.Name ~= "theamazemanII" and player.Name ~= "BUTSTINK" and player.Name ~= "brickfusion" then
	message.Text = "Welcome "..player.Name.." to Berk!"
	wait(3)
	message:remove()
	else
	message.Text = "Welcome the Chief Viking "..player.Name.." to Berk!"
	humanoid.MaxHealth = 500
	humanoid.Health = 500
	wait(3)
	message:remove()

for _, player in pairs(game.Players:GetPlayers()) do
	PlayerAdded(player)
		end
	end
end

2 answers

I can spot 2 errors in your script. First of all, you attempt to call 'player' many times in the function, but the variable (or parameter) doesn't seem to exist.

The second one is in your last block of code. You're attempting to call the function PlayerAdded, but from the code you've provided, that doesn't seem to exist either.

2 comments

0

didnt work =(

0

What did you try? You need to provide more context.

function onPlayerEntered()
    local humanoid = player.Character:findFirstChild("Humanoid")
    local message = Instance.new("Message", game.Workspace)
    message.Parent = game.Workspace
    if player.Name ~= "theamazemanII" and player.Name ~= "BUTSTINK" and player.Name ~= "brickfusion" then
    message.Text = "Welcome "..player.Name.." to Berk!"
    wait(3)
    message:remove()
    else
    message.Text = "Welcome the Chief Viking "..player.Name.." to Berk!"
    humanoid.MaxHealth = 500
    humanoid.Health = 500
    wait(3)
    message:remove()

for _, player in pairs(game.Players:GetPlayers()) do
    PlayerAdded(player)
        end
    end
end

1 comment

0

still not working

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