Ad
Log in to vote
1

Why wont this script function correctly?

Asked by
Itheol 5
1 month ago
Edited by Xapelize 1 month ago

I'm attempting to create a shop that you can buy tools from after collecting enough of the in game currency-"fish" however, when I collect the required amount of fish and click the purchase button nothing happens.

Here's the script and the error message I'm getting.

game.ReplicatedStorage.toolevents.swordevent.OnServerEvent:Connect(function(player)
    if player.leaderstats.fish.Value >= 250 then
        player.leaderstats.fish.Value = player.leaderstats.fish.Value - 250
        game.ServerStorage.tools.sword:Clone().Parent = player.Backpack
    end
end)

game.ReplicatedStorage.toolevents.gun.OnServerEvent:Connect(function(player)
    if player.leaderstats.fish.Value >= 750 then
        player.leaderstats.fish.Value = player.leaderstats.fish.Value - 750
        game.ServerStorage.tools.gun:Clone().Parent = player.Backpack
    end
end)

game.ReplicatedStorage.toolevents.rocket.OnServerEvent:Connect(function(player)
    if player.leaderstats.fish.Value >= 1000 then
        player.leaderstats.fish.Value = player.leaderstats.fish.Value - 1000
        game.ServerStorage.tools.rocket:Clone().Parent = player.Backpack
    end
end)

ParentMouseButton1Click is not a valid member of LocalScript "Players.ITheol.PlayerGui.shop.Frame.sword.fireevent"

1 answer

Log in to vote
1
Answered by
Xapelize 2586 Moderation Voter Community Moderator
1 month ago
Edited 1 month ago

You're missing a dot between ParentMouseButton1Click in your LocalScript. It's supposed to be Parent.MouseButton1Click

Ad

Answer this question