Hi, I want that a value in a local script finds a model.
The local script is in a tool and the model too.
I tried some things but it didn’t helped me.
Here the code:
bin = script.Parent
function onButton1Down(mouse)
local model = script.Parent.PoliceBarrierPlace:clone() -- Here is the error
model.Parent = game.Workspace
local Parts = model:GetChildren()
Parts.CanCollide = true
Parts.Anchored = false
Parts.Transparency = 0
model.Part.SurfaceGui1.Enabled = true
model.Part.SurfaceGui2.Enabled = true
model.CFrame = bin.PoliceBarrier.CFrame
wait(2)
end
function onEquipped(mouse)
if mouse == nil then
return
end
mouse.Button1Down:Connect(function()
onButton1Down(mouse)
end)
end
script.Parent.Equipped:Connect(onEquipped)
Here are some pictures:
(The script is inside Spawner)
(The game output)
Does anyone know why this is not working?