i have no idea what to say about it. idk how to explain im also tired
local SellFolder = script.Parent.PartSell.Selling
local Shared = game.ReplicatedStorage:WaitForChild("SharedCash")
script.Parent.Doohickey.Sell.Event:Connect(function()
print("HAASDAOIGFASDUSDFGASAFDGHSDFAHJ")
for _, v in SellFolder:GetChildren() do
if v.Parent:IsA("Model") then
if v.Name == "Engine" then
Shared += 10
elseif v.Name == "Tank" then
Shared += 10
elseif v.Name == "Battery" then
Shared += 5
elseif v.Name == "HeadLights" then
Shared += 5
elseif v.Name == "Hood/Trunk" then
Shared += 5
elseif v.Name == "Console" then
Shared += 15
elseif v.Name == "Cabin" then
Shared += 20
elseif v.Name == "Board" then
Shared += 2
elseif v.Name == "Seat" then
Shared += 5
elseif v.Name == "Stick" then
Shared += 1
else
Shared += 1
end
v:Destroy()
print("TeeHee")
end
end
end)
“print(“HAASDAOIGFASDUSDFGASAFDGHSDFAHJ”)” works fine
“print(“TeeHee”)” does not work
And so it seems like v.Parent isn’t a model but it’s a folder AKA SellFolder if you didn’t catch what I meant yet (so it’s not getting past the first check)
if it’s only models, then this should be the code for the loop
local COST_MAP = {
Engine = 10,
Tank = 10,
Battery = 5,
HeadLights = 5,
["Hood/Trunk"] = 5,
Console = 15,
Cabin = 20,
Board = 2,
Seat = 5,
Stick = 1,
}
local SellFolder = script.Parent.PartSell.Selling
local Shared = game.ReplicatedStorage:WaitForChild("SharedCash")
script.Parent.Doohickey.Sell.Event:Connect(function()
print("HAASDAOIGFASDUSDFGASAFDGHSDFAHJ")
for _, v in SellFolder:GetChildren() do
if v:IsA("Model") then
Shared.Value += COST_MAP[v.Name] or 1
v:Destroy()
print("TeeHee")
end
end
end)
also cleaned up ur code a bit using a lookup table