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

Is there a way to compare PlayerNames with a bool?

Asked by
cc567 50
7 years ago

This doesn't seem to work for me, and yes it's in a LocalScript

Player = game.Players.LocalPlayer

Name = Player.Name

if Name = "Builderman" then print ("Welcome Builderman")

1 answer

Log in to vote
1
Answered by 7 years ago

Your question doesn't really sum up what you want, but I will fix your code.

Your syntax is incorrect meaning you used an = sign, this is only to set a value, if you want to compare a value in Lua, you use 2 equal signs like this== Also, you forgot and end at well, the end... Fixed code bellow:

Player = game.Players.LocalPlayer

Name = Player.Name

if Name == "Builderman" then 
    print ("Welcome Builderman") 
end

--Keep in mind your name is not Builderman so this wont work for you, obviously

If this helped, accept this answer! Any questions/Problems? Comment them bellow

Ad

Answer this question