Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why wont this Work?

Asked by 10 years ago

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

Log in to vote
0
Answered by
MrFlimsy 345 Moderation Voter
10 years ago

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.

0
didnt work =( theamazemanII 32 — 10y
0
What did you try? You need to provide more context. MrFlimsy 345 — 10y
Ad
Log in to vote
0
Answered by
IcyEvil 260 Moderation Voter
10 years ago
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
0
still not working theamazemanII 32 — 10y

Answer this question