I made a system that when you buy a 2x multiplier it gives you 2x scarap(the currency were working with)

workspace.collectables:WaitForChild("PartA").ClickDetector.MouseClick:Connect
(function(player) -- this function argument is at the end of the line above 
	
local ValA = player.Val.Value

		if ValA == 0 then
		player.scrap.Value = player.scrap.Value + Mval
	elseif ValA == 1 then
		player.scrap.Value = player.scrap.Value + Tval
			
			
	end	
end)			


and the button that increases the number values code is

script.Parent.MouseButton1Click:Connect(function()
	if game.Players.LocalPlayer.Val.Value == 0 then 
		game.Players.LocalPlayer.Val.Value = game.Players.LocalPlayer.Val.Value + 1
	end

end)

that is a local script

5 comments

0

the script works when i change it while im in edit mode

0

am i crazzy

0

Make ALL changes to the server. Not to the client. If you make changes to the client, the exploiters can have a field day with your code.

0

Any errors? Try debugging.

0

And don't change the values via a local script as @Dovydas1118 said. Use remote events to fire to the server, and handle the addition there.