I'm working on a small clicker game and my biggest issue right now is actually adding the currency when the button is clicked. I don't see anything issues here but maybe someone can find it because I've had this issue for a lot of other games I've done.
My localscript for the button.
local add = game.ReplicatedStorage.Remotes.ClickEvent local plr = game.Players.LocalPlayer local lstats = plr:WaitForChild("leaderstats") local ice = lstats:WaitForChild("Ice").Value local click = lstats:WaitForChild("Ice per Click").Value local gui = script.Parent gui.MouseButton1Click:Connect(function() add:FireServer(plr) end) gui.MouseEnter:Connect(function() gui:TweenSizeAndPosition(UDim2.new(0.6,0,0.8,0),UDim2.new(0.4,0,0.2,0),"Out","Quint",0.25) end) gui.MouseLeave:Connect(function() gui:TweenSizeAndPosition(UDim2.new(0.45,0,0.6,0),UDim2.new(0.475,0,0.3,0),"Out","Quint",0.25) end)
My script for the remote event.
script.Parent.OnServerEvent:Connect(function(plr) local lstats = plr:FindFirstChild("leaderstats") local click = lstats:FindFirstChild("Ice per Click") local ice = lstats:FindFirstChild("Ice") ice.Value = ice.Value+click.Value end)
It just doesn't seem to work ad I can't find the issue because there is no issue in the output.
ServerScripts do not run in replicatedstorage, you will have to put the script in serverscriptservice and fix up your variables