Okay, so I've made a door that only allows you claim one. It uses a value to see if you have the room. I've tried multiple times to move code, recalculate the same thing, and still nothing. Please review my code and help me make doors claimable only once.
Here's my snippet of code:
local Click = script.Parent.ClickDetector
local default = ""
local defaultAv = "Available Room"
local ImageLabel = script.Parent.Parent.ImageLabel.SurfaceGui.ImageLabel
local text2 = script.Parent.Parent.Text.SurfaceGui.TextLabel
local UserValue1 = script.Parent.Parent.WhoID
local UserValue2 = script.Parent.Parent.WhoUser
local pwc
Click.MouseClick:Connect(function(playerWhoClicked)
if playerWhoClicked:WaitForChild("HasRoom").Value == true then
print("You already have a room!")
else
pwc = playerWhoClicked
playerWhoClicked:WaitForChild("HasRoom").Value = true
UserValue2.Value = playerWhoClicked.Name
Click.MaxActivationDistance = 0
UserValue1.Value = playerWhoClicked.UserId
text2.Text = playerWhoClicked.Name.."'s Room"
end
end)

2 comments
Are there any errors?
I fixed it, really odd though