so i have this code:
local HumanoidRootPart = script.Parent
local Time = script.Time
HumanoidRootPart.Anchored = true
print("anchored")
wait(Time.Value)
print(Time.Value)
print("unanchored")
HumanoidRootPart.Anchored = false
script:Destroy()
in my script it was suposed to be for 5 seconds, it even printed the time.value to 5, but i don’t know why it gets deleted after 0.2 or 0.1 seconds i really don’t get it
1 Like
Make sure you didn’t accidently set it to .5
some other scripts that calls the first one:
local StayInAir = function(character, seconds)
local HumanoidRootPart = character.HumanoidRootPart
local StayInAirScript = game.ServerStorage.Katana.StayInAirScript:Clone()
if HumanoidRootPart:FindFirstChild("StayInAirScript")then
HumanoidRootPart.StayInAirScript:Destroy()
end
StayInAirScript.Parent = HumanoidRootPart
StayInAirScript.Time.Value = seconds
end
Launch.OnServerEvent:Connect(function(plr)
local CanAttack = plr.CombatRelated.CanPerformAttack
CanAttack.Value = false
local weapon = script.Parent
local TInfo = TweenInfo.new(0.4, Enum.EasingStyle.Quart, Enum.EasingDirection.InOut)
local hum = game.Workspace:FindFirstChild(plr.Name).Humanoid
local Tween = TS:Create(hum.Parent.HumanoidRootPart, TInfo, {CFrame = hum.Parent.HumanoidRootPart.CFrame * CFrame.new(Vector3.new(0,10,0))})
local Static = TS:Create(hum.Parent.HumanoidRootPart, TweenInfo.new(0.2), {CFrame = hum.Parent.HumanoidRootPart.CFrame})
module.DoLaunchDamage(plr)
Tween:Play()
wait(0.4)
StayInAir(hum.parent, 5)
end)
it isn’t @ImTheBuildGuy
30 c h a r a c t e r s
Have you tried simply doing wait(5)
?
i need it to be a variable value because i will use it many times with other values
i also tried to do wait (10) and it worked perfectly
how about local Time = 5
?
i can’t change that from another script 
Is it a serverside or local script?
it’s a server side script
30 chars
And I assume the Time value is an IntValue?
Because you can’t wait(String)
nope, it’s a number value, sorry for forgetting to say that
Try changing it to an IntValue, and see what happens
Edit: Has anything happend yet?
i need it to be a number value tough because in some cases i would need very fast anchored times
Well, it can hold negative numbers, so you can go pretty fast with an IntValue. Just try.
oh
lol
solved it
it’s still a number value but now it isn’t inside the script anymore
30 characters
It was that simple? You forgot to put it in the script?
no, it was in the script but it was bugged out so i put it aside the script like the script goes in HumanoidRootPart and Time also there and i reffer to Time by script.Parent.Time