Why do my instance positions mess up?

so I have an instance in my game that spawns alright the first time but the second time it spawns like 100 studs away in a random direction I have set the position as an instance.position but it works the first time and then after that, it does what it wants, what should I do?

1 Like

Can we see the script?
(use ``` to fomat scripts)

2 Likes
	rad2.Name = "rad2man"
	rad2.Anchored = true
	rad2.CanCollide = false
	rad2.Shape = rad.Shape
	rad2.BrickColor = rad.BrickColor
	rad2.Transparency = rad.Transparency
	rad2.Size = rad.Size
	rad2.Position = rad.Position
1 Like

It will set its Position to be the same as Rad, Check where Rad is and it should be there.

Im assuming it has a table of parts which is what rad is and you are doing
YourTable[math.random(1,table.getn(YourTable))]

Am I correct in assuming this is how its basically set up. If so keep in mind that if parts move it would no longer be 100 in that direction without rechecking its position

2 Likes

i am using a tool and rad never goes anywhere rad just goes invisible and the rad is attached to the tool
it works fine on a local script but i need it to work on a server script and i am not using math.random.

1 Like

Ok so this is more of a client - server replication issue. You would need to use remote events / function. Or another form of client - server communication.

Things created in a local script only show and have an effect on that player. For it to effect all players it would have to be created in a script.

If you took your clients local script and put its contents into a script. It wont be able to get some things such as the players mouse and the parents would be different.

1 Like

sorry i need to make sure you understand me rn, so it works well in a local script but i need it to work in a server script is there a way to do that?

1 Like

You would have to have two scripts

The reason why is because the server script cant get certain things like the players camera or their mouse and the client cant make parts appear for everyone.

So the local script will have to pass data on to the script in the server in order to do this. Some means of client and server communication will be required.

Perhaps these will show you more:

3 Likes

thanks for the help ill be sure to check them out.

1 Like

Ok so I found out how to do it, I put in 2 scripts 1 local 1 server and in the server, I make the clone and with the local I use WaitForChild() to find the clone and i put in my scripts in the clone and i made the clone destroy itself after 15 secs (my cooldown) so if you want to make a clone and find it with a local script first get server script use it to make the clone then in your local script use WaitForChild()
to find it and use it hope this helps!