So I added currency in my game and obviously, I need to add a shop, but why surface ui shop will not work and I do not know how to fix it. Please help.

Button Script:




script.Parent.MouseButton1Click:Connect(function()
	local player = game.Players.LocalPlayer
	local character = player.Character
	local humanoid = character.Humanoid
	print("R")
	if player.Values.Points.Value >= script.Parent.Parent.Price.Value then
		print("E")
		humanoid.Health = humanoid.Health + script.Parent.Parent.NumItem * 2
		print("K")
		script.Parent.Parent.NumItem = script.Parent.Parent.NumItem + 1
		local event = game.ReplicatedStorage.RemoteEvents.Event
		event:FireServer()	
		print("T")
		player.Values.Points.Value = player.Values.Points.Value - script.Parent.Parent.Price
	end
	
end)


Server Script:




local event = game.ReplicatedStorage.RemoteEvents.Event

event.OnServerEvent:Connect(function(player,Price)
	player.Values.Points.Value = player.Values.Points.Value - Price
end)


5 comments

0

What exactly doesn't work? Is there an error message? Is the ButtonScript a LocalScript? The event:FireServer() doesn't provide a price argument, so, it would already error out at line 12. You will have to be more specific.

0

there's no error, nothing happens when you click it

0

the only error is 16:47:33.217 - Failed to download plugin: HTTP 409 (Conflict)

0

since you have the script print out letters R, E, K, T, which ones does it print out? If none, then your script simply doesn't run. If it is a LocalScript (I assume it is) then it has to be a child of Game.Player.LocalPlayer (backpack, GUI, etc.)or player's character.

0

none of them print