Hi im a noob. This code is giving a bit of trouble. No errors tho.
What do you want to achieve?
I have this in a model, and when I duplicate the model, I don’t want the player to buy both stalls. only one in the workspace.
What is the issue?
I know the issue is the way i’m going i am coming at the script design. Brain just abit over fried. I’m not getting any errors. just the executions of making this happen.
What solutions have you tried so far?
Solutions tried… I put print statements all over to make sure but strange, its like it skips past the else and print both after buying the either the first and also the second house.
Script im using ----
stallprice = script.Parent.Parent:WaitForChild("Price")
currentowner = script.Parent.Parent:WaitForChild(“CurrentOwner”)
local worktab = game.Workspace:GetChildren()
if player:FindFirstChild("leaderstats") and player.Name ~= currentowner.Value and currentowner.Value == "" then --Check to make sure people doesnt buy more than one Stall for i,v in pairs(worktab) do if v.Name == (player.Name.."'s Stall") then print("have a stall") else print("doesnt have a stall") if player.leaderstats.Coins.Value >= stallprice.Value then script.Parent.Parent.Name = player.Name.."'s Stall" script.Parent.FrontGui.TextLabel.Text = player.Name.."'s Stall" player.leaderstats.Coins.Value = player.leaderstats.Coins.Value - stallprice.Value script.Parent.Parent.CurrentOwner.Value = player.Name end end end end
doesnt have a stall (x25)
have a stall
Then clicking on second house
doesnt have a stall (x21)
have a stall