Local script (Button)
local button = script.Parent
local plr = game.Players.LocalPlayer
local processEvent = workspace:WaitForChild("processEvent")
local cost
local Type
button.Activated:Connect(function()
Type = "Jump"
cost = 50
local process = function()
processEvent:FireServer(plr, cost, Type)
print("plr, cost, type = " .. plr.Name,cost,Type)
end
local guiUpdate = function()
end
process()
end)
A part of the leaderstats script
local tf = true
processEvent.OnServerEvent:Connect(function(plr, plr, cost, Type)
print("receiced")
if Type == "Jump" and tf == true then
tf = false
print("receiced")
if game.Players:WaitForChild(plr.Name):WaitForChild("leaderstats"):WaitForChild("Coins").Value >= cost*game.Players:WaitForChild(plr.Name):WaitForChild("Folder"):WaitForChild("JumpLevel").Value then
game.Players:WaitForChild(plr.Name):WaitForChild("leaderstats"):WaitForChild("Coins").Value = game.Players:WaitForChild(plr.Name):WaitForChild("leaderstats"):WaitForChild("Coins").Value - game.Players:WaitForChild(plr.Name):WaitForChild("Folder"):WaitForChild("JumpLevel").Value*cost
game.Players:WaitForChild(plr.Name):WaitForChild("Folder"):WaitForChild("JumpLevel").Value = game.Players:WaitForChild(plr.Name):WaitForChild("Folder"):WaitForChild("JumpLevel").Value + 1
game.Players:WaitForChild(plr.Name):WaitForChild("Folder"):WaitForChild("JumpPower").Value = 50 + 3 * game.Players:WaitForChild(plr.Name):WaitForChild("Folder"):WaitForChild("JumpLevel").Value
workspace:WaitForChild(plr.Name).Humanoid.JumpPower = game.Players:WaitForChild(plr.Name):WaitForChild("Folder"):WaitForChild("JumpPower").Value
end
tf = true
else
end
end)
All the values get multiplied by the number of players (I think) but I'm not sure how to fix it.
