I’m trying to make a computer hacking system, the animation works. But when I move my character it doesn’t stop the animation neither make the ProximityPrompt visible again. You will understand down below in the code:
ComputerModule:
local computerModule = {}
function computerModule.ActivateComputers(computerFolder)
for _, computer in pairs(computerFolder:GetChildren()) do
if not computer:FindFirstChild("ProximityPrompt") then local PP = Instance.new("ProximityPrompt", computer) end
computer:FindFirstChild("ProximityPrompt").Triggered:Connect(function(plr)
computer.ProximityPrompt.Enabled = false
local HackingAnimation = script:WaitForChild("HackingAnim")
wait()
local Character = plr.Character
local Humanoid = Character.Humanoid
local HackingAnimationTrack = Humanoid:LoadAnimation(HackingAnimation)
while wait(1.10) do
HackingAnimationTrack:Play()
end
if Humanoid.MoveDirection.Magnitude > 0 then
HackingAnimationTrack:Stop()
computer.ProximityPrompt.Enabled = true
end
end)
end
end
return computerModule
Output:
local ComputerModule = require(script.ComputerModule)
if workspace:FindFirstChild("ComputerFolder") then
ComputerModule.ActivateComputers(workspace.ComputerFolder)
else
warn("ComputerFolder unavailable")
end