now its not breaking the welds
It should be breaking the weld of the one that you click on, does it not happen?
no… heres an example script of how i arranged it:
events["Tank"] = Tank.ClickDetector.MouseClick:Once(function(plr)
plr.ObjSelected.Value = false
if Tank:FindFirstChild("Weld") then
print("Removing weld!")
Tank.Weld:Destroy()
end
local Weld = Instance.new("Weld")
Weld.Parent = Tank
Weld.Part0 = Tank
Weld.Part1 = Type.PlacementPart
print("Moved"..Type.Name.."To Tank!")
for _,v in events do
if typeof(v) == "RBXScriptConnection" then v:Disconnect() end
end
end)
Could you send me an rbxl file of the game for me to debug it? I can’t really tell the issue unless i get to see it myself
i should mention, only the battery and engine are placeable, click the top or bottom of them and then click a ball o the car frame
1 Like
have u found anything out yet?
Here, this should work (replace the entire CarFrameNew script with this):
--Ignition Check Values
local ICV = script.Parent.ICV
local HasBat = ICV.HasBattery
local HasTank = ICV.HasTank
local HasEng = ICV.HasEngine
local IgButton = script.Parent.Button
local CallSound = game.ReplicatedStorage:WaitForChild("EnginePlaySound")
local Click = script.Parent.StartB2.Click
IgButton.ClickDetector.MouseClick:Connect(function()
print("farted")
Click:Play()
if HasBat.Value == true then
--play a electric noise
CallSound:Fire("Battery")
if HasEng.Value == true then
--play Start noise
CallSound:Fire("Start")
if HasTank.Value == true then
--StartLoop
task.wait(3)
CallSound:Fire("Loop")
else
-- play fail noise
task.wait(3)
CallSound:Fire("Fail")
end
end
end
end)
--Nodes
local Nodes = script.Parent.Nodes
local Tank = Nodes.Tank
local RBL = Nodes.RightBackLight
local LBL = Nodes.LeftBackLight
local Engine = Nodes.Engine
local Battery = Nodes.Battery
local FLL = Nodes.FrontLeftLight
local FRL = Nodes.FrontRightLight
--Other Values
local objselected = nil
local PlaceSender = game.ReplicatedStorage:WaitForChild("PlaceSender")
local PlaceReciver = game.ReplicatedStorage:WaitForChild("PlaceReciver")
local events = {}
--Node Sender
PlaceSender.Event:Connect(function(Param, Type)
print("Started")
if Param == "Ready" then
if Type:FindFirstChild("ConnectionWeld") then
print("Removing weld!")
Type.ConnectionWeld:Destroy()
if Type.Name == "Battery" then
HasBat.Value = false
end
end
events["Tank"] = Tank.ClickDetector.MouseClick:Once(function(plr)
plr.ObjSelected.Value = false
local Weld = Instance.new("Weld")
Weld.Parent = Type
Weld.Name = "ConnectionWeld"
Weld.Part0 = Tank
Weld.Part1 = Type.PlacementPart
print("Moved"..Type.Name.."To Tank!")
for _,v in events do
if typeof(v) == "RBXScriptConnection" then v:Disconnect() end
end
end)
events["RBL"] = RBL.ClickDetector.MouseClick:Once(function(plr)
plr.ObjSelected.Value = false
local Weld = Instance.new("Weld")
Weld.Parent = Type
Weld.Name = "ConnectionWeld"
Weld.Part0 = RBL
Weld.Part1 = Type.PlacementPart
print("Moved"..Type.Name.."To RightBackLight!")
for _,v in events do
if typeof(v) == "RBXScriptConnection" then v:Disconnect() end
end
end)
events["LBL"] = LBL.ClickDetector.MouseClick:Once(function(plr)
plr.ObjSelected.Value = false
local Weld = Instance.new("Weld")
Weld.Parent = Type
Weld.Name = "ConnectionWeld"
Weld.Part0 = LBL
Weld.Part1 = Type.PlacementPart
print("Moved"..Type.Name.."To LeftBackLight!")
for _,v in events do
if typeof(v) == "RBXScriptConnection" then v:Disconnect() end
end
end)
events["Engine"] = Engine.ClickDetector.MouseClick:Once(function(plr)
plr.ObjSelected.Value = false
local Weld = Instance.new("Weld")
Weld.Parent = Type
Weld.Name = "ConnectionWeld"
Weld.Part0 = Engine
Weld.Part1 = Type.PlacementPart
print("Moved"..Type.Name.."To Engine!")
for _,v in events do
if typeof(v) == "RBXScriptConnection" then v:Disconnect() end
end
end)
events["Battery"] = Battery.ClickDetector.MouseClick:Once(function(plr)
plr.ObjSelected.Value = false
local Weld = Instance.new("Weld")
Weld.Parent = Type
Weld.Name = "ConnectionWeld"
Weld.Part0 = Battery
Weld.Part1 = Type.PlacementPart
print("Moved"..Type.Name.."To Battery!")
if Type.Name == "Battery" then
HasBat.Value = true
end
for _,v in events do
if typeof(v) == "RBXScriptConnection" then v:Disconnect() end
end
end)
events["FLL"] = FLL.ClickDetector.MouseClick:Once(function(plr)
plr.ObjSelected.Value = false
local Weld = Instance.new("Weld")
Weld.Parent = Type
Weld.Name = "ConnectionWeld"
Weld.Part0 = FLL
Weld.Part1 = Type.PlacementPart
print("Moved"..Type.Name.."To FrontLeftLight!")
for _,v in events do
if typeof(v) == "RBXScriptConnection" then v:Disconnect() end
end
end)
events["FRL"] = FRL.ClickDetector.MouseClick:Once(function(plr)
plr.ObjSelected.Value = false
local Weld = Instance.new("Weld")
Weld.Parent = Type
Weld.Name = "ConnectionWeld"
Weld.Part0 = FRL
Weld.Part1 = Type.PlacementPart
print("Moved"..Type.Name.."To FrontRightLight!")
for _,v in events do
if typeof(v) == "RBXScriptConnection" then v:Disconnect() end
end
end)
end
end)
Yeah that seems to work! ill tell you if i find any more issues
1 Like
hey are you still there? i found another issue…
heres a video:
(for context, with multiple cars when placing parts the cars will randomly weld to eachother)
Where exactly did the battery go?
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.