Values are same but it wont work!

the script wont work even if plr and plr2 are equal (its where is block) :

local CD = script.Parent
local deb = false
local plr2 = game.ServerStorage.Slot1.Owner.Value

print(plr2)

CD.MouseClick:Connect(function(plr)
print(plr, plr2)
if plr2 == plr then
print(“bruh”)
if deb == false then
game.ServerStorage.Slot1.Money.Value = game.ServerStorage.Slot1.Money.Value + 1
script.Parent.Parent.ParticleEmitter.Enabled = true
wait(0.1)
script.Parent.Parent.ParticleEmitter.EmissionDirection = false
deb = false
end
end
end)

any help?

This is a common problem, plr2 and plr are in fact not the same, unless Slot1 is an instance/object value, you are comparing an instance with a string. The Clickdetecter returns the plr as an instance and i am guessing plr2 is a string so to fix that it should be as easy as doing plr.Name or using tostring on the plr

3 Likes

Thank you very much for your help :smiley: it worked !