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

How would I send a bot back to a position when it touches a brick?

Asked by
Relatch 550 Moderation Voter
9 years ago

I have a bot, (model, that moves around and damages on touch). I want to make it when it touches a brick, it is sent back to the position it spawned in. I don't have much experience with this, so I could use some help. This is it so far.

model = Bot

script.Parent.Touched:connect(function(touched)
    if touched == model then
    touched.Position = UDim2.new() --position
end)

1 answer

Log in to vote
-2
Answered by 9 years ago

You can't use UDim2 for 3D positioning. Instead you should be using Vector3.

In the end your code should look like this:

model = Bot

script.Parent.Touched:connect(function(touched)
    if touched == model then
    touched.Position = Vector3.new()--position
end
end)
0
Didn't fully answer my question, but thanks for the advise. Relatch 550 — 9y
Ad

Answer this question