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 3 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)

script.Parent.MouseButton1Click:Connect(function()
    local player = game.Players.LocalPlayer
    if player then
    script.Parent.goodjob:FireServer(player)
    end 
    end)

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

script.Parent.goodjob.OnServerEvent:Connect(function(player)
    local sword = game.Lighting.DualRage
    local diamonds = player.diamonds.diamonds.Value
    if diamonds >= 300 then
        diamonds = diamonds - 300
        local prize = sword:Clone()
        prize.Parent = player.StarterGear
        local prize2 = sword:Clone()
        prize2.Parent = player.Backpack
    end
    end)

Answer this question