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

How do I make it so if I click a block it spawns a tool?

Asked by 2 years ago

Heres the code I tried:

local Clicker = script.Parent 
    local Object = game.ReplicatedStorage:WaitForChild("Key3") 
    local ObjectSpawn = game.Workspace:WaitForChild("ObjectSpawn")

    Clicker.onClicked:Connect(function()
        local CloneObject = Object:Clone()
        CloneObject.Parent = game.Workspace
    CloneObject.Position = Vector3.new(ObjectSpawn.Position)
        end)

1 answer

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

UPDATE:

I figured it out, the script I used:

script.Parent.MouseClick:Connect(function() 
    local Object = game.ReplicatedStorage.Key3 
    Object.Parent = workspace 
    Object.Position = script.Parent.Parent.Position + Vector3.new(-105.8, 1.05, 63.4)

end)
Ad

Answer this question