hello, im making that you can register on a ring to participate in a match.But my problem is that if you register, someone else can register at the same place.
heres the hierarchy
heres the registration code
script.Parent.ProximityPrompt.Triggered:Connect(function(plr)
if plr:FindFirstChild("PlrStats"):FindFirstChild("isRegistred").Value == false then
script.Parent.Parent.PlayerOne.Value = plr.Name
plr:FindFirstChild("PlrStats"):WaitForChild("isRegistred").Value = true
script.Parent.SurfaceGui.TextLabel.Text = "Player One : "..plr.Name
end
end)
script.Parent.Parent.PlayerOne:GetPropertyChangedSignal("Value"):Connect(function()
script.Parent.SurfaceGui.TextLabel.Text = "Player One : "..script.Parent.Parent.PlayerOne.Value
end)
You could add a check statement to see whether a player already has claimed that ring or not
script.Parent.ProximityPrompt.Triggered:Connect(function(plr)
local plrStats = plr:FindFirstChild("PlrStats")
if plrStats and plrStats:FindFirstChild("isRegistered") then
local isRegistered = plrStats.isRegistered.Value
if not isRegistered then
script.Parent.Parent.PlayerOne.Value = plr.Name
plrStats.isRegistered.Value = true
script.Parent.SurfaceGui.TextLabel.Text = "Player One: " .. plr.Name
else
-- if the player tries to claim and someone already has here you could add additional code for that siutuation
end
end
end)
script.Parent.Parent.PlayerOne:GetPropertyChangedSignal("Value"):Connect(function()
script.Parent.SurfaceGui.TextLabel.Text = "Player One: " .. script.Parent.Parent.PlayerOne.Value
end)