Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My click detector wont work (should clone on click)?

Asked by 4 years ago
Edited 4 years ago

Its supposed to make a clone of MyPart when clicked but it wont Error says: Workspace.MyClickDetectorEvent.Script:10: Expected ')' (to close '(' at line 1), got <eof>

heres the code:

game.workspace.MyClickDetectorEvent.OnServerEvent:Connect(function()



    local Object = game.Workspace.PartToClone
    local ClonedObject = Object:clone()



    end

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago
game.workspace.MyClickDetectorEvent.OnServerEvent:Connect(function()



    local Object = game.Workspace.PartToClone
    local ClonedObject = Object:Clone(game,Workspace)



    end)


--//Another way of doing it:--\\


game.workspace.MyClickDetectorEvent.OnServerEvent:Connect(function()


        local Object = game.Workspace.PartToClone
        local ClonedObject = Object:Clone()
        ClonedObject.Parent = game:GetService('Workspace')




    end)





You just need to set the parent of the Cloned Object, also close the brackets at the end.

Ad

Answer this question