Hello,
So I got a script here where there’s a trigger and when you touch it, the AI stops peeking behind the wall. The thing is, the movement is going faster than I’d like and I haven’t figured out why as I’m not really a scripter. I played around with the code for 5 mins, looked at possible threads relating to this, checked the API, still couldn’t find something useful. It doesn’t even look like it moved actually from how fast it goes, looks like it flat out disappeared.
Script:
local trigger = script.Parent.Parent.trigger
local holdpart = script.Parent.Parent.holdingpart
local Debounce = false
local model = script.Parent.Parent
trigger.Touched:Connect(function(hit)
if not Debounce then
if hit.Parent:FindFirstChild("Humanoid") then
Debounce = true
for i= 2, 2 do
script.Parent.CFrame = script.Parent.CFrame * CFrame.new(2,0,0)
wait()
end
for i= 2, 2 do
script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0,0,0)
wait(2)
Debounce = false
script:Destroy()
model:Destroy()
end
end
end
end)
Video:
Easier explanation: The part I touched is the trigger, once it’s been touched the creature is made to move to the left hiding using the script I provided. The thing is, it hides too fast and not slow.
I’d appreciate anyone’s help/explanation on what’s causing this as I’d love to know!