I want to do that when player clicks part then other part in workspace clones.
theres script:
local cl = game.Workspace["Cube Template"]:Clone()
cl.Name = "Cube"
cl.Parent = game.Workspace
cl.Anchored = false
cl.CanCollide = true
i tested this so many times, i also tried to do print, nothing worked
this is server script.
1 Like
GE_0E
(GE_0E)
August 21, 2024, 7:09pm
2
maybe the script ran before the cube load did u get any errors?
1 Like
no i didnt get any errors in output
1 Like
Can you show the whole script? It might be to do with how you handle the click detection.
1 Like
its actual full script, lol i just started
I assume that’s your issue then. You don’t ever listen for the ClickDetector, you just immediately clone the part, and then the script finishes.
script.Parent.MouseClick:Connect(function()
...
end)
Put your code in this event connection, so that it runs every time you click on the ClickDetector.
its doesnt works, i put script into click detector and tested, nothing works(yeah i changed first string too so theres no errors)
GE_0E
(GE_0E)
August 21, 2024, 7:48pm
10
make sure ur script is activated
TestyLike3
(TestyLike3)
August 21, 2024, 7:48pm
11
Can I just double check what your code looks like now? And I want to make sure that this script is parented to a ClickDetector, which is parented to the part you want to click on.
iv_pdd100
(iv_pdd)
August 21, 2024, 7:51pm
12
script.Parent.MouseClick:Connect(function(plr)
print("v", plr) -- just tested
local cl = game.Workspace["Cube Template"]:Clone()
cl.Name = "Cube"
cl.Parent = game.Workspace
cl.Anchored = false
cl.CanCollide = true
end)
1 Like
TestyLike3
(TestyLike3)
August 21, 2024, 7:54pm
13
If you’re sure the code runs perfectly fine without errors, can you try to offset the part when you spawn it?
iv_pdd100
(iv_pdd)
August 21, 2024, 7:55pm
14
you mean just do wait()? i dont think that gonna work, cuz theres no errors in output(sorry if i dont understand you right)
TestyLike3
(TestyLike3)
August 21, 2024, 7:59pm
15
No, I meant it’s position, to make sure it’s not somehow getting stuck inside the original.
For example, set it to the player’s position like this:
cl.Position = plr.Character.PrimaryPart.Position
local ClickDetector = script.Parent
local Cube = game.Workspace["Cube Template"]
local function onClicked()
local Clone = Cube:Clone()
Clone:Clone()
Clone.Position = Cube.Position + Vector3.new(0, 10, 0) -- Position
Clone.Name = "Cube"
Clone.Parent = game.Workspace
Clone.Anchored = false
Clone.CanCollide = true
end
ClickDetector.MouseClick:Connect(onClicked)
iv_pdd100
(iv_pdd)
August 21, 2024, 8:00pm
17
nothing changed, cube dont even added
iv_pdd100
(iv_pdd)
August 21, 2024, 8:01pm
18
doesnt work, no any errors in output
That’s not true because I tested it and it works.
Insert a Part. Put a ClickDetector in it. Put a Script in the ClickDetector.
Make sure you have a Part in the Workspace called “Cube Template”
iv_pdd100
(iv_pdd)
August 21, 2024, 8:06pm
20
then why it dont works with my
still dont works