I have made a GUI button that fires an event if a value in a player is true, but the event does not fire, even if the value is true. Can anyone notice what's wrong with my script?

rs = game:GetService("ReplicatedStorage")
event = rs:FindFirstChild("Hat1Event")

function onClick(plr)
	if plr.Hats.Hat1.Value == true then
		event:FireServer()
	else
		script.Parent.Parent.OofText.Visible = true
		wait(0.8)
		script.Parent.Parent.OofText.Visible = false
	end
end
script.Parent.MouseButton1Click:Connect(onClick)

3 comments

0

don't use global variables

0

Remove the plr parameters on line 4 and 5. Use LocalPlayer instead.

0

Remove the plr parameters on line 4 and 5. Use LocalPlayer instead.