I’m trying to update a knockback value through a gui (the knockback value is stored in a numbervalue), but the value used when knockback is applied isn’t updating along with the gui and actual numbervalue being changed. (it is in a normal script, not a local script so using RunService.RenderStepped won’t work)
if it helps, here’s the script:
-- /* Roblox Services / --
local Debris = game:GetService("Debris")
local RunService = game:GetService("RunService")
local damage = script.Parent.Parent.Damage.Value
local knockback = script.Parent.Parent.Knockback.Value
-- / Variables / --
local func = script.Parent.punched
local maxpower = 15 --/this?/--
-- / Event Listeners / --
func.OnServerInvoke = function(plr, hum, dmg, tor)
-- / Sound plays and added to debris
local sound= Instance.new("Sound")
sound.SoundId= "rbxassetid://1023128237"
Debris:AddItem(sound, 5)
sound.Parent = tor
sound.RollOffMinDistance = 1000
sound:Play()
-- /* Humanoid take damage / --
hum.Health = hum.Health - damage
-- / Knockback */ --
hum.Jump = true
local BodyVelocity = Instance.new("BodyVelocity", hum.Parent.HumanoidRootPart)
Debris:AddItem(BodyVelocity, 2)
local cfr = script.Parent.Parent.Parent.HumanoidRootPart.CFrame.LookVector * knockback --/this?/--
BodyVelocity.P = maxpower
BodyVelocity.Velocity = cfr
wait(1) --/this?/--
BodyVelocity:Destroy()
hum.Jump=false
end`