Hi!
Recently, Me and @vf9r have tried to make a House System.
We are finding an error in the WaitForChild.
What’s wrong?
(All scripts, error is probably in te first one)
local mod = game.ServerScriptService:WaitForChild("FurnitureMod")
local furniture = require(mod)
local plr = game.Players.LocalPlayer
local mouse = game.Players.LocalPlayer:GetMouse()
local dragging = false
coroutine.wrap(function()
while dragging == true do
print(dragging)
print("starting")
while wait(.01) do
furniture.drag(game.ReplicatedStorage.Furniture[script.Parent.Parent.Furniture.Value],mouse.Hit.p,plr)
end
end
end)
script.Parent.MouseButton1Click:Connect(function()
dragging = true
end)
local template = script.Parent.ACard
for i,v in pairs(game.ReplicatedStorage.Furniture:GetChildren()) do
local new = template:Clone()
new.TextLabel.Text = v.Price.Value
new.Furniture.Value = v.Name
new.Parent = script.Parent
wait()
end
template.BackgroundTransparency = 1
template.ImageButton.ImageTransparency = 1
template.TextLabel.TextTransparency = 1
local module = {}
function module.drag(model,cframe,plr)
if model and cframe and plr then
--//sanity check
if plr.BuildMode.Value == true then
local newModel = model:Clone()
newModel.Parent = workspace
for i,v in pairs(newModel:GetChildren()) do
if v:IsA("Part") or v:IsA("MeshPart") or v:IsA("TrussPart") or v:IsA("UnionOperation") or v:IsA("CornerWedgePart") then
v.Transparency = .2
--//set transparency for effect
end
end
newModel:SetPrimaryPartCFrame(cframe)
--//set the cframe
end
end
end
function module.place(model,cframe,plr)
if model and cframe and plr then
--//sanity check
if plr.BuildMode.Value == true then
model:SetPrimaryPartCFrame(cframe)
--//set the cframe
for i,v in pairs(model:GetChildren()) do
if v:IsA("Part") or v:IsA("MeshPart") or v:IsA("TrussPart") or v:IsA("UnionOperation") or v:IsA("CornerWedgePart") then
v.Transparency = 0
--//make sure the transparency is no longer .2 if was dragged
end
end
end
end
end
function module.chargeUser(model,plr)
if model and plr then
--//sanity check
if plr.Flex_Points then
plr.Flex_Points.Value = plr.Flex_Points.Value - model:FindFirstChild("Price").Value
end
end
end
return module
I think that’s it.
Thanks for any help supplied!