Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to make Character Stop while in Walktopoint?

I have this script that forces the player to walk forward until it hits a brick, which is SUPPOSED to make the character regain control.

The problem is, I don't know what to put in the vector3 part to make the character walk with controls. Doing 0,0,0 does't work, it just makes the character go to those chords. I have also tried nil and nil,nil,nil but those do the same.

This is the script in the brick that's supposed to change it back to normal

function a(b) 
if b.Parent:findFirstChild("Humanoid") ~= nil then 
local h = b.Parent:findFirstChild("Humanoid") 


if h ~= nil then 
	while true do

h.WalkToPoint = Vector3.new(32.4, 8.4, 32.8)
wait()
	end 
	end


end 
end 
script.Parent.Touched:connect(a) 

2 comments

0

Can I see the script that makes the character walk?

0

remove the wait maybe?

1 answer

http://wiki.roblox.com/index.php?title=Controlling_a_Player%27s_Character So we can get rid of the ability to walk and give it back with this script.

local controllers = {} -- Create a table to store the controllers in
 
function removeControl()
	for _, controller in pairs(game:GetService("ControllerService"):GetChildren()) do
		controller.Parent = nil -- Take the controller out of ControllerService
		table.insert(controllers, controller) -- Save it for later
	end
end
 
function resumeControl()
	for _, controller in pairs(controllers) do
		controller.Parent = game:GetService("ControllerService") -- Put the controller back into ControllerService
	end
	controllers = {} -- Clear the table
end
 
removeControl() -- Disable their control over their character
game.Players.LocalPlayer.Character.Humanoid:MoveTo(Vector3.new(0, 0, 0)) -- Make the character walk somewhere
wait(5)
resumeControl() -- Give them control over their character again

Now we add this with your script:

local controllers = {}
function removeControl()
	for _, controller in pairs(game:GetService("ControllerService"):GetChildren()) do
		controller.Parent = nil -- Take the controller out of ControllerService
		table.insert(controllers, controller) -- Save it for later
	end
end
function resumeControl()
	for _, controller in pairs(controllers) do
		controller.Parent = game:GetService("ControllerService") -- Put the controller back into ControllerService
	end
	controllers = {} -- Clear the table
end
function a(b) 
if b.Parent:findFirstChild("Humanoid") ~= nil then 
local h = b.Parent:findFirstChild("Humanoid") 


if h ~= nil then 
removeControl()
h.WalkToPoint = Vector3.new(32.4, 8.4, 32.8)
    end
wait(5) --After sometime
resumeControl()

end 
end 
script.Parent.Touched:connect(a) 


It's late so I cant really explain, I hope it helps!

1 comment

0

Thank you, it works, but I have a problem with it, and that is, Even if I change the wait (5) it goes to the place have to go, but then my character stops and I can't move for 5 seconds. I set the wait to (0.001) and it still does this

This discussion is preserved as it was. New answers, comments, and votes are closed.