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

Event won't fire when button is pressed?

Asked by 5 years ago

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)

0
don't use global variables green271 635 — 5y
0
Remove the plr parameters on line 4 and 5. Use LocalPlayer instead. User#19524 175 — 5y
0
Remove the plr parameters on line 4 and 5. Use LocalPlayer instead. User#19524 175 — 5y

Answer this question