I'm making it so when you buy an upgrade using a button, it increases value, which will increase the number of swings you get. But no matter how many times I buy an upgrade, it won't increase swings (no errors in output)
-- Button (local script)
local level = script.Parent.Parent.Level.Level
local value = script.Parent.Parent.ValueIncrease.Increase
local cost = script.Parent.Parent.Cost.Cost
local player = game.Players.LocalPlayer
local leaderstats = player:WaitForChild("leaderstats")
local playergui = player:WaitForChild("PlayerGui")
local value = playergui.MainGui.ShopFrame.ButtonHolder.ValueIncrease.Increase
script.Parent.MouseButton1Click:Connect(function()
if leaderstats.Gold.Value >= cost.Value then
leaderstats.Gold.Value = leaderstats.Gold.Value - cost.Value
cost.Value = (cost.Value * 2.25)
cost.Parent.Text = "Cost: "..cost.Value
level.Value = level.Value + 1
level.Parent.Text = "Level: "..level.Value
value.Value = (value.Value * 2)
value.Parent.Text = "+"..value.Value
end
end)
-- Sword Script (local script)
local rep = game:GetService("ReplicatedStorage")
local trail = script.Parent.Handle:WaitForChild("SwordTrail")
local animations = {"4935490802","4935921704",}
local CanAttack = true
script.Parent.Activated:connect(function()
if CanAttack == true then
local animation = Instance.new("Animation", script.Parent.Parent)
animation.AnimationId = "http://www.roblox.com/asset?id="..animations[math.random(1, #animations)]
local chosenanim = script.Parent.Parent.Humanoid:LoadAnimation(animation)
chosenanim:Play()
trail.Enabled = true
rep.RemoteEvents.SwordClicked:FireServer()
script.Parent.Handle.woosh:Play()
CanAttack = false
wait(.75)
trail.Enabled = false
CanAttack = true
print("success should work")
end
end)
--serverscriptservice script
local value = game.StarterGui.MainGui.ShopFrame.ButtonHolder.ValueIncrease.Increase.Value
game.ReplicatedStorage.RemoteEvents.SwordClicked.OnServerEvent:Connect(function(plr)
plr.leaderstats.Swings.Value = plr.leaderstats.Swings.Value + (value * plr.leaderstats.Sacrifice.Value)
end)

1 comment
Put print statements in different parts of your script to see which one isnt running, and if one doesnt run, it's in that block of code