Still have questions? Join our Discord server and get real time help.
Log in to vote
0

Can i ask for help for slow effects that will back the normal walkspeed of a npc?

Asked by 5 months ago

Can somene help me about the problem that im having now because i tried to make slow effect in my script and i make for example -10 Walkspeed and for 2 sec i want it to back the normal walkspeed i try to make this for example:

player.Parent.Humanoid.WalkSpeed = -10 wait(2) player.Parent.Humanoid.Walkspeed = 16

but this code will make the npc more fast and i want it to back there normal walkspeed for example npc only have 10 Walkspeed and it will back the 10 normal speed but if the code is like my example it will make him +6 faster so does anyone know about a code that make player or npc back there normal speed?

0
use -10 first, then +10 or store the original value so you can restore it later RubenKan 3455 — 5mo
0
i'll try to test RealPlays20 -6 — 5mo
0
it didn't work because its giving me red warning uhhm can i ask how to store value? RealPlays20 -6 — 5mo

2 answers

Log in to vote
0
Answered by 5 months ago

If you just wanted it to go back to the default walkspeed you gave it earlier, then why not try this code:

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:wait()

Character.Humanoid.Walkspeed = 1 --I think setting it to a negarive value will remove the npc's ability to walk
wait(2)
Character.Humanoid.Walkspeed = 10


to incorporate this into a tool or something use a touch function

--Let's say you would like to incorporate it in a magic power you just scripted
script.Parent.Touched:Connect(function(hit)
local Humanoid = hit.Parent:findFirstChild("Humanoid")

if Humanoid then
Humanoid.Walkspeed = 1
wait(2)
Humanoid.Walkspeed = 10
end

end)


If this does not answer your question, please do leave a comment saying that it didn't with an elaboration of the problem. Thanks!

0
thanks for answering but still it didn't work beacuse for example if i have npc that have only 10 walkspeed and for player that have 16 walkspeed it will be unfair for player because it will slow the player RealPlays20 -6 — 5mo
0
I still don't get what you're tryna say, unfortunately. xXKingCool258Xx 14 — 5mo
Log in to vote
0
Answered by 5 months ago

Thanks for anyone who answer my question and it give me some clue now i already fix it and it help me a lot for giving me a clue thank you guys

0
You know that comments exist, right? Even if you didn't want to comment, you could edit your question to include this message. User#25115 0 — 5mo