✓ Accepted answer
That Stamina Int Value must be equal to 0. Thats why It's being substracted, if not Your probably doing something client side and server side. which aren't supposed to be happening.
I'm assuming that its appearing as -30 because in the server it's (The actual number of the value) but your substracting it in the client. So you'll have to substract in the server:
Local Script
local Remote = Instance.new("RemoteEvent")
Remote.Parent = game.ReplicatedStorage
script.Parent.Activated:Connect(function()
Remote:FireServer(Stamina)
wait(.9)
print(Stamina)
end)
Server Script
game.ReplicatedSotrage.OnServerEvent:Connect(function(Player,Stamina)
Stamina = Stamina - 30
end)
There may be some problems and you'll need to adjust it to work with your script.
Put the server script inside of serverscriptservice
2 comments
Ah okay, I figured that doing it on the client was the problem. Thanks!
Okay, so for some reason if I have the Server Script in ServerScriptService it just says "StaminaScript is not a valid member of ServerScriptService", however if I put the script in Workspace it works but when I swing the sword it prints "0", but it should be 70 since I only want it to subtract 30.