1
votes

I created a template or when someone touches that template, it's destroyed, but it's only for that person. I try to clone the model with a local script, but it does not work.

local part2 = script.Parent.MarioBrick:Clone()
part2.Parent = game.Workspace.Camera
2
Where is your LocalScript? If it is not in StarterPlayer > StarterPlayerScripts or StarterCharacterScripts, or cloned into the player when they spawn. there is a chance it is not running. - Kylaaa

2 Answers

0
votes

I believe cloning the script's parent will also clone the script itself, and run the script again. Are you doing this intentionally? If not then it can cause strange side effects to happen.

Edit: Sorry, I misread your code.

0
votes

Your code looks fine. I suspect that your problem is that your LocalScript is not in a place that is run by clients. If you want a LocalScript to run, it needs to exist on a Player's model somewhere. An easy way to do this is to add the LocalScript into StarterPlayer > StarterCharacterScripts This will clone the contents into the character when they spawn. Here's my example that seems to work :

local testPart = Instance.new("Part")
testPart.BrickColor = BrickColor.Random()
testPart.Position = Vector3.new(math.random(-10, 10), 1, math.random(-10, 10))
testPart.Parent = game.Workspace.Camera

When I go into the Test tab, I can start a server with 3 players. Each of those 3 players will see a different color cube somewhere different.