That code will never run in a billion years.
Functions only run when they are called. Calling a function means asking it to run by putting two parentheses after its name:
There's nothing special about naming your function playerAdded
. It's just a normal function that won't run until you tell it to.
But you don't want your function to only run once, you want it to run when a player joins. This is why we use an event. Connecting a function to an event will make it so that Roblox calls it when the event fires.
We connect the PlayerAdded event to our function:
4 | game.Players.PlayerAdded:connect(sayHi) |
Now it will run when someone joins.
Another problem lies with line 07,
1 | game.Workspace.IsItBep.Value = player.Name() |
Name
is a property, so we shouldn't use parentheses to access it. Instead, write:
1 | game.Workspace.IsItBep.Value = player.Name |
But we can take this out entirely just by checking the name directly:
1 | if player.Name = = "Bep0man" then |
And you have a lot of pointless variables, for example, you wrote:
1 | local m = Instance.new( "Message" ) |
2 | m.Parent = game.Workspace |
5 | local me = game.Workspace.ItsBep 0 |
While you could just keep using the variable m
.
And,
1 | local sv = Instance.new( "StringValue" ) |
2 | sv.Parent = game.Workspace |
5 | local stringv = game.Workspace.IsItBep |
While you could just keep using the variable sv
.