I'm trying to make a remote control car tool, it's supposed to do that when you unequip the tool, the car objectvalue is set to nil (nothing) and the "RemoteControlConnected" value in the car is supposed to be false. But for some reason, nothing happens. The "RemoteControlConnected" is not set to false and the ObjectValue is not set to nil, it's still set to the car? It's a serverscript inside an object value, parented to a tool. Why is this happening?
local value = script.Parent.VehConnected.Value
local tool = script.Parent
tool.Unequipped:Connect(function()
if value ~= nil then
print("Remote unequipped with vehicle connected, disconnecting...")
for i,v in pairs(value:GetDescendants()) do
pcall(function()
if v.Name == "OwnerName" then
v.TextLabel.Text = "Not connected"
end
end)
end
value.RemoteControlConnected.Value = false
wait(3)
value = nil
end
end)
