I am making an Imagebutton that when clicked on, it checks to see if your ID matches the localplayer's ID. if so, it will tell you that you cant battle yourself.
It keeps giving me the failed output. Anyone know the reason why? both "id" and "localplayerid" match when tested.
local id = script.Parent.Parent.PlayerID.Value
local text = script.Parent.Battletext
local localplayerid = game.Players.LocalPlayer.UserId
script.Parent.MouseButton1Click:connect(function()
print(id)
print(localplayerid)
if id == localplayerid then
print("cant battle yourself!")
else
print("failed")
end
end)

3 comments
Is the PlayerID value a StringValue? NumberValue? IntValue?
String
I just changed it to IntValue, it's now solved. I tried using PlayerID to store other data, when I don't need it.