I made a script that when a player touches the door, the house becomes theirs and lets say 75 dollars is deducted from the players money. I suck at scripting, and this doesnt work i need help....
things to know -- the leaderstats script is located in workspace
local debounce = false local player = game.Players.LocalPlayer local money = game.Workspace.Leaderstats('Money') local amount = script.Parent.Parent.Price function onTouch(hit) if hit == nil then return end if hit.Parent == nil then return end if not game.Workspace:FindFirstChild("Home"..hit.Parent.Name) then if game.Players:findFirstChild(hit.Parent.Name) ~= nil and debounce == false then debounce = true local b = script.Parent.Parent:Clone() b.Parent = game.Lighting b.Name = "Home"..hit.Parent.Name wait(.4) script.Parent.Parent.Ay.Value = hit.Parent.Name if money >= amount then money.Value = money.Value - amount end script.Parent.Head:Remove() script.Parent.Parent["Home: Nobody"].Name = "Home: "..hit.Parent.Name script.Parent.Parent.Parent.Name = "Home"..hit.Parent.Name end else end wait(3) debounce = false end script.Parent.Head.Touched:connect(onTouch)