clicked = 0
script.Parent.MouseButton1Click:connect(function()
player = script.Parent.Parent.Parent.Parent.Parent
if clicked == 0 then
if not player:FindFirstChild("Car") then
car = Instance.new("Model", Workspace)
car.Parent = player
car.Name = "Car"
end
script.Parent.BorderSizePixel = 2
script.Parent.BorderColor3 = Color3.new(255, 0, 0)
local addon = game.Lighting.cartestpart1:Clone() --change
addon.Parent = player.Car
addon.Position = Vector3.new(68.1, 5.79, 16.1)
clicked = 1
elseif clicked == 1 then
script.Parent.BorderSizePixel = 0
script.Parent.BorderColor3 = Color3.new(53, 53, 53)
clicked = 0
end
end)
I'm trying to make a button that adds an object/model to a truck. I can't get it to work. And I'm stuck
OUTPUT: 'Players.Player1.PlayerGui.CarShop.BackGround.ClickTest.Scri', Line 12 17:48:23.445 - Stack End 17:48:23.447 - Disconnected event because of exception

1 comment
Setting a = means you have to do more then change parent like.. If it is a script you may need to enable it