Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why wont this script function correctly?

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

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

This discussion is preserved as it was. New answers, comments, and votes are closed.