game.Players.PlayerAdded:Connect(function(plr)
local uis = game:GetService("UserInputService")
plr:WaitForChild("leaderstats")
local _stats = plr.leaderstats
local strenght = _stats.Strenght
local Defense = _stats.Defense
local KI = _stats.KI
local Physic = _stats.Physic
local smulti = _stats:WaitForChild("smulti")
local kmulti = _stats:WaitForChild("kmulti")
local dmulti = _stats:WaitForChild("dmulti")
local pmulti = _stats:WaitForChild("pmulti")
local tp = _stats.TP
local add = game:GetService("ReplicatedStorage").Add.Value
local db = false
uis.InputBegan:Connect(function(input, gameProccesedEvent)
if input.KeyCode == Enum.KeyCode.F then
if db == false then
db = true
strenght.Value=strenght.Value + add.Value * smulti.Value
wait(0.2)
db = false
end
end
if input.KeyCode == Enum.KeyCode.Q then
if db == false then
db = true
KI.Value=KI.Value + add.Value * kmulti.Value
wait(0.2)
db = false
end
end
if input.KeyCode == Enum.KeyCode.V then
if db == false then
db = true
Defense.Value=Defense.Value + add.Value * dmulti.Value
wait(0.2)
db = false
end
end
if input.KeyCode == Enum.KeyCode.Y then
if db == false then
db = true
Physic.Value=Physic.Value + add.Value * pmulti.Value
wait(0.2)
db = false
end
end
end)
while wait(0.2) do
tp.Value = strenght.Value + Physic.Value + KI.Value + Defense.Value
end
end)
not a lot of info to go off of here, but if i had to assume anything it’d be that your trying to manipulate values in a localscript, which will not work. only server scripts can do that and trying to do that in a localscript will at best give you the illusion that you are changing the value.
you should research bindable and remote events as those allow for localscript to server script communication which is the only way for you to gain strenght via keypresses.
still even if you are using a server script remote events allow for server scripts to take events from local scripts and that should allow you to run this code when a user presses a certain button.
be careful to make sure that the event is secure though as exploiters can simply call the event multiple times and make their strenght many time stronger.