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

How would I make a part where, on touch, makes the player moved to the desired location?

Asked by 5 years ago

Please include the code which you are trying to use, so the community will be better-equipped to help you with your problem.

Title explains everything. How would I make a part where, if I touched said part, your player would automatically move (without touching any keys) to the set location? I'm not talking about teleporting a player to a location btw, I'm talking about having the player walking to desired location. Thanks!

0
Please make an attempt first. TheeDeathCaster 2368 — 5y

2 answers

Log in to vote
0
Answered by
Filipalla 504 Moderation Voter
5 years ago

For this example i put the script in the part

script.Parent.Touched:Connect(function(hit) --checks parent(Part) for touching and puts the part that touched it into a variable called hit
    if hit.Parent:FindFirstChildOfClass("Humanoid") then --checks if the part is the part of a players character
        local Position = Vector3.new(5,5,5) --the position that you want to teleport to(5,5,5 is just for example). To get the position you want to teleport to you can move a brick there and copy the Position property or put YourPartName.Position as the Position variable to teleport to a part
        hit.Parent:MoveTo(Position) --Move the character to the position you choosed
    end
end)

Wiki Pages:

MoveTo

Vector3

Touched

FindFirstChildOfClass

I put alot of time and effort into writing these answers and would really appreciate if you accepted my answer as the solution(if it worked. Please comment if it didn't soo i can change it to make it work) and upvoted it

Most of my answers are tested in Roblox Studio and should work

Ad
Log in to vote
-4
Answered by 5 years ago

Please provide explanation with your answers. Simply posting code does not spread knowledge of integral scripting processes which helps people understand the logic and reasoning behind your answer.
part.Touch:Connect(function(hit)
    local desired_position =  -- *Position of the place or part*--
    character.Humanoid:MoveTo(desired_position)
end)
0
-1 for no explanation and incorrect event name. User#25115 0 — 5y

Answer this question