I don't know what to do with this script, it's really ruining my leaderboard values
script.Parent.MouseButton1Click:connect(function() local p = game.Players.LocalPlayer local s = script.Parent.Sound s:Play() p.leaderstats.Bux.Value = p.leaderstats.Bux.Value + 1 local o = game.ReplicatedStorage.One:clone() o.Parent = p.PlayerGui o.TextLabel:TweenPosition(UDim2.new(0.61, 0,0.661, 0), 'Out', 'Bounce', 1.5) wait(1) o:Destroy() end)
You need to use remote events. Insert script in serverscriptservice and type this...
--[[Server Script]]-- local Event = Instance.new("RemoteEvent") Event.Parent = game:GetService("ReplicatedStorage") Event.Name = "TestEvent" Event.OnServerEvent:Connect(function(player, bux) --player who fired, bux is cost of bux local stats = player.leaderstats stats.Bux.Value = stats.Bux.Value + bux end)
and here is your fixed localscript
--[[ LocalScript ]]-- local Event = game:GetService("ReplicatedStorage").TestEvent script.Parent.MouseButton1Click:connect(function() local p = game.Players.LocalPlayer local s = script.Parent.Sound s:Play() Event:FireServer(1) -- 1 is bux value what we firing to server local o = game:GetService("ReplicatedStorage"):WaitForChild("One"):Clone() o.Parent = p.PlayerGui o.TextLabel:TweenPosition(UDim2.new(0.61, 0,0.661, 0), 'Out', 'Bounce', 1.5) wait(1) o:Destroy() end)