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

What is the problem with this?

Asked by 9 years ago

What's the problem with this script?

function script(player)
if Game.Players.PlayerAdded.Name == "Player1" then -- Player1 is for testing
s = Instance.new ("Message")
s.Parent = Game.Workspace
s.Text = "The owner has joined!"



end
end

2 answers

Log in to vote
1
Answered by 9 years ago

This should work

game.Players.PlayerAdded:connect(function(player)
    if player.Name == "Player1" then
        s = Instance.new("Message")
        s.Name = "asd"
        s.Parent = Game.Workspace
        s.Text = "The owner has joined"
        wait (3)
        game.Workspace.asd:Destroy()

    end
end)

i added

wait (3)
game.Workspace.asd:Destroy()

or else the message will stay there forever

Ad
Log in to vote
-2
Answered by
Mystdar 352 Moderation Voter
9 years ago

I'm not too sure, but aren't

function
if
then

all functions, so wouldn't you need 3 ends instead of two? Sorry if this doesn't help, new to scripting, trying to help.

end
end
end
1
Myst, then goes with if groovydino 2 — 9y
0
Oh sorry, then, apologies Mystdar 352 — 9y

Answer this question