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

how do i teleport a copy to a random position?

how do I get a script to teleport the copied model to a random location? I want the script to get the copied model and put the model into a random location. Still isn't working

 local original = script.Parent.Parent
    -- Create the model copy
   local  copy = original:Clone()
    -- Parent the copy to the same parent as the original
    copy.Parent = original.Parent
    -- Move the copy so it's not overlapping the original
    copy:SetPrimaryPartCFrame(CFrame.new(math.random(1,2000000), math.random(1,20), math.random(1,200)))
		script.Parent:Destroy()	
end
end)

please answer

5 comments

1

what are your ends for? remove those and I THINK everything else is ok unless I missed something

1

2 million is a lot, are you sure it isn't just moving the part to where you can't see it?

0

It's probally as the person above says, one note; you set the "original" to script.Parent.Parent and in the end you only destroy script.Parent(a part of the model, not the whole model), Not sure if this is intentional

0

I want it to be see able but i just want to show an example

0

what do you mean by end

1 answer

✓ Accepted answer

Here's your problem:

copy:SetPrimaryPartCFrame(CFrame.new(math.random(1,2000000), math.random(1,2000000), math.random(1,200000)))

You're setting the X,Y,Z Positions of the part to potentially extremely far distances in your worldspace.

Consider changing these positions to a more confined area:

local offset = 5 -- offset the Y axis so it doesn't go too high or under the map
copy:SetPrimaryPartCFrame(CFrame.new(math.random(-100,100),offset,math.random(-100,100)))

3 comments

0

Click view source to see the rest of the code, idk why its not showing the rest.

0

Showing fine for me

0

Sorry it dosent work! but thank you for trying

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