x = script.Parent function onMouseClick() noob = game.Lighting.Troll:Clone() noob.Name = "Troll" noob.Position = Vector3.new(-77.6, 2.4, 31.2) noob.Parent = Workspace noob:MakeJoints() x.Locked = true x.Transparency = 1 x.CanCollide = false x.BrickColor = "Earth green" wait (3) x.Locked = false x.Transparency = 0 x.CanCollide = true x.BrickColor = "Dark stone grey" end x.MouseClick:connect(onMouseClick)
It's supposed to make it so whenever I click the brick, the brick dissapears and a monster named "Troll" appears. Only it's not dissapearing and no Troll is appearing. My script is in Workspace>Part>ClickDetector>Script.
I guess you could say I'm being "Trolled"
Thanks in advance!
You name x as "script.Parent", but if the script is in the ClickDetector it will not be able to change the properties you listed. You may also want to use a different method to move the "Troll", I think I heard somewhere that you have to use something else.
You forgot to add ClickDetector in your connection line, and messed up on a few BrickColors.
x = script.Parent function onMouseClick() noob = game.Lighting.Troll:Clone() noob.Name = "Troll" noob.Position = Vector3.new(-77.6, 2.4, 31.2) noob.Parent = game.Workspace noob:MakeJoints() x.Locked = true x.Transparency = 1 x.CanCollide = false x.BrickColor = BrickColor.new("Earth green") wait (3) x.Locked = false x.Transparency = 0 x.CanCollide = true x.BrickColor = BrickColor.new("Dark stone grey") end x.ClickDetector.MouseClick:connect(onMouseClick)
Well the first thing i noticed that was wrong about your script was your connection line it should be x.ClickDetector.MouseClick:connect(onMouseClick) i took out the Positioning portion of the code i could't get it to work but here is the working script.
x = script.Parent detector = Instance.new("ClickDetector",x) --I prefer scripting in ClickDetector's function onMouseClick() noob = game.Lighting.Troll:Clone() noob.Name = "Troll" noob.Parent = Workspace noob:MakeJoints() x.Locked = true x.Transparency = 1 x.CanCollide = false x.BrickColor = "Earth green" wait (3) x.Locked = false x.Transparency = 0 x.CanCollide = true x.BrickColor = "Dark stone grey" end x.ClickDetector.MouseClick:connect(onMouseClick) --fixed