Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I stop following?

Asked by
neoG457 315 Moderation Voter
9 years ago
local player = game.Players.LocalPlayer
repeat wait() until player.Character
local mouse = player:GetMouse()

while true do
wait()
if mouse.Hit then
player.Character.Humanoid.WalkToPoint = mouse.Hit.p
end
end

This makes my character follow my mouse however, I want it to stop after a certain amount of time like 10 seconds. Help me!!11

2 answers

Log in to vote
0
Answered by
ItsMeKlc 235 Moderation Voter
9 years ago
local player = game.Players.LocalPlayer
repeat wait() until player.Character
local mouse = player:GetMouse()
local seconds = 10 -- Put how long you want it to happen here

for i=1,seconds*100 do true do
wait(0.01)
if mouse.Hit then
player.Character.Humanoid.WalkToPoint = mouse.Hit.p
end
player.Character.Humanoid.WalkToPoint = player.Character.Humanoid.Torso.Position
end

Ad
Log in to vote
1
Answered by 9 years ago
local player = game.Players.LocalPlayer
repeat wait() until player.Character
local mouse = player:GetMouse()
local breaker = Instance.new("Part")
game:GetService("Debris"):AddItem(breaker,10)
while true do
wait()
if mouse.Hit  and breaker ~= nil then
player.Character.Humanoid.WalkToPoint = mouse.Hit.p
end
if breaker == nil then
break
end
end
0
Doesnt work m8 neoG457 315 — 9y

Answer this question