I’m working on a VFX script. My goal is to try to make the script detect when the person is running and when it isn’t, so if the person is running, it can emit particles, and when they’re not running, it doesn’t emit particles.
So what’s my problem??
My current script… is not very reliable. It doesn’t always work. If a person jumps, the effects don’t stop. I’ve tried using FloorMaterial, :GetState() method, and so on, to no avail. If anything, it made things worse so, I reverted the script.
What can I do to fix this? Thanks!
local function onRunning(speed)
if speed > 0 then
print("Person is running")
if isRunning == true then
return
else
isRunning = true
Event:Fire("Run", isRunning)
end
else if speed == 0 then
print("Person stopped or in air")
print(speed)
isRunning = false
Event:Fire("Idle", isRunning)
end
end
end
humanoid.Running:Connect(onRunning)
This is part of the script in charge of detecting when a person is running or vice versa. What can I do to stabilize this script?
It’s not my PC that’s laggy heh, it’s the footage. It’s using a lot of resources since I’m on studio. Also, do you think that UIS would be helpful and efficient in this case? because the person could be falling and still have particles. So I don’t think it’s the most efficient.
Though I’ve already tried FloorMaterial as I mentioned. It didn’t work out very well. Also, isn’t there a more efficient way so I don’t have to make different functions for the same purpose, just different conditions?