My upgrade system isn’t working Upgrade Failed shows in the output without an error coming up. Also how would I try to debug this?
Lcoal Script
local replicatedStorage = game:GetService("ReplicatedStorage")--Defines replicated storage
local upgrades = game.Players.LocalPlayer.PlayerGui.ScreenGui2.Upgrade.Cost.Cost:WaitForChild('UpgradesIntValue')
local RemoteEvent = game.ReplicatedStorage.RemoteEvent
local success--Variable
script.Parent.MouseButton1Click:Connect(function()
success = false
if upgrades.Value < 100 then
success = RemoteEvent:FireServer()
end
if success then
print("Upgraded Successfully")
else
print("Upgrade Failed")
end
end)
ServerScript
local Event = game.ReplicatedStorage.RemoteEvent
Event.OnServerEvent:Connect(function(player)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local upgrades = game.Players:FindFirstChild(player.Name).PlayerGui.ScreenGui2.Upgrade.Cost.Cost:WaitForChild('UpgradesIntValue')
local increase = 1.5
local price = upgrades.Value*increase
if player.leaderstats.Elixir.Value >= price then
player.leaderstats.Elixir.Value = player.leaderstats.Elixir.Value - price
upgrades.Value = upgrades.Value + 1
return true
else
return false
end
end)