I've been able to get everything to work except the money being deducted from your wallet I buy the door and it makes me the owner but takes no money. Any help is very appreciated!!
local ting = 0 --debouncer owner = script.Parent.Parent.Parent.OwnerName --This is the thing that holds the owners name
function OnPrompt(Player) if ting == 0 then --debounce check ting = 1 --activate debounce local check = Player.Character:FindFirstChild("Humanoid") --Find the human that touched the button
if check ~= nil then --If a human is found, then
local user = game.Players:GetPlayerFromCharacter(Player) --Find human among the players
local Data = game.ReplicatedStorage.Data:FindFirstChild(Player.Name)
if Player:FindFirstChild("rig") then
script.Parent.ProximityPrompt.ActionText.Text = "You already own a house" --Put text into the message
wait(3) --Wait to let the message display for a while
script.Parent.ProximityPrompt.ActionText.Text = "Claim House"
else
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local DataFolder = ReplicatedStorage:WaitForChild("Data")
local userObject = DataFolder:FindFirstChild(Player.Name)
if userObject then
local walletValue = userObject:FindFirstChild("Wallet").Value
if walletValue >= 5000 then
walletValue = walletValue - 5000
owner.Value = Player.Name --save new owners name for later.
local own = Instance.new("IntValue")
own.Name = "rig"
own.Parent = user
script.Parent.ProximityPrompt.ActionText = "You now own this house!" --Put text into the message
script.Parent.Purchased:Play()
wait(1)
script.Parent.ProximityPrompt.Enabled = false
else
script.Parent.ProximityPrompt.ActionText = "You don't have enough money to buy this house!"
wait(3)
script.Parent.ProximityPrompt.ActionText = "Claim House"
end
end
end
end
ting = 0 --remove debounce
end
end
script.Parent.ProximityPrompt.Triggered:connect(OnPrompt) --Start listening for button-touchers.

1 comment
completely correct.