I have this script when you press a button it takes a value and gives it to you and sets the value to 0 but it doesnt do any of that. I have FE on and normally a script like this would work.

-- Button clicked events
for _, Descendant in pairs(Descendants) do
	if Descendant:IsA("ImageButton") then
		Descendant.MouseButton1Click:Connect(function()
			local InteractGui = script.Parent.Parent.InteractGui.Adornee.Parent
			local PlayerStats = ReplicatedStorage.PlayerStats
			for i = 1, PlayerStats[InteractGui.Name][Descendant.Parent.Name].Value do
				print(PlayerStats[InteractGui.Name][Descendant.Parent.Name].Value)
				PlayerStats[Player.Name][Descendant.Parent.Name].Value = PlayerStats[Player.Name][Descendant.Parent.Name].Value + 1
				PlayerStats[InteractGui.Name][Descendant.Parent.Name].Value = PlayerStats[InteractGui.Name][Descendant.Parent.Name].Value - 1
			end
		end)
	end
end

There is the code, if you have any ideas please do help :)

2 comments

0

Is the code above in a local script or a server script?

0

Its a local script