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

Why is my gui button not working to fire the remote event?

Asked by 4 years ago

I made a gui that lets you buy a sword but when you click the button it wont fire the event to purchase the sword and there are no errors can you pls help me?

LOCAL SCRIPT(THIS IS IN THE PLAYERS GUI)

1script.Parent.MouseButton1Click:Connect(function()
2    local player = game.Players.LocalPlayer
3    if player then
4    script.Parent.goodjob:FireServer(player)
5    end
6    end)

SERVER SCRIPT(THIS IS IN THE PLAYERS GUI ALSO AND SO IS THE REMOTE EVENT)

01script.Parent.goodjob.OnServerEvent:Connect(function(player)
02    local sword = game.Lighting.DualRage
03    local diamonds = player.diamonds.diamonds.Value
04    if diamonds >= 300 then
05        diamonds = diamonds - 300
06        local prize = sword:Clone()
07        prize.Parent = player.StarterGear
08        local prize2 = sword:Clone()
09        prize2.Parent = player.Backpack
10    end
11    end)

Answer this question