Hi developers! I’m currently experiencing a problem regarding my claim register system for my cafe. Just a reminder that I’m still exploring the world of programming and I’m still a beginner. The problem is this:
When I tried to claim, it claims. I also tried to unclaim it with ProximityPrompt, it worked so far. The only problem is that I can’t claim it back. I’ve tried to find a solution for the past 4 hours and I still haven’t found it yet until this very moment. I really need your help if possible.
For your guidance, here is my local script. I just need help in determining what’s the script mistake or what should I add in order for it to get claimed back.
local claimedRegisRemote = game.ReplicatedStorage:WaitForChild('ClaimRegis')
claimedRegisRemote.OnClientEvent:Connect(function(register)
local prox = register.Prompt.ProximityPrompt
prox.Enabled = true
prox.ActionText = "Unclaim"
end)
local unclaimedPrompt = game.Workspace.Registeryess.Prompt.ProximityPrompt
local player = game.Players.LocalPlayer
unclaimedPrompt.Triggered:Connect(function()
local plroldreg = player.ClaimedRegister.Value
plroldreg.Prompt.ProximityPrompt.ActionText = "Claim"
game.ReplicatedStorage.UnclaimRegis:FireServer(player)
end)
Here are the other scripts:
For the ProximityPrompt:
local prox = script.Parent
local register = prox.Parent.Parent
local display = register.Display
local claimedRegisRemote = game.ReplicatedStorage.ClaimRegis
prox.Triggered:Connect(function(plr)
local claimedRegis = plr.ClaimedRegister
if claimedRegis.Value == nil then
prox.Enabled = false
claimedRegis.Value = register
display.SurfaceGui.playerName.Text = plr.Name .. "'s Register"
display.SurfaceGui.ImageLabel.ImageTransparency = 0
display.SurfaceGui.ImageLabel.Image = game.Players:GetUserThumbnailAsync(plr.UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size60x60)
claimedRegisRemote:FireClient(plr, register)
else
return
end
end)
For the ServerScriptService:
game.Players.PlayerAdded:Connect(function(plr)
local regisValue = Instance.new("ObjectValue")
regisValue.Name = "ClaimedRegister"
regisValue.Parent = plr
end)
game.Players.PlayerRemoving:Connect(function(plr)
local claimedRegis = plr.ClaimedRegister.Value
if claimedRegis then
claimedRegis.Display.SurfaceGui.playerName.Text = "Claim Register"
claimedRegis.Display.SurfaceGui.ImageLabel.Image = " "
claimedRegis.Display.SurfaceGui.ImageLabel.ImageTransparency = 1
claimedRegis.Prompt.ProximityPrompt.Enable = true
claimedRegis.Prompt.ProximityPrompt.ActionText = "Claim"
end
end)
game.ReplicatedStorage.UnclaimRegis.OnServerEvent:Connect(function(plr)
local claimedRegis = plr.ClaimedRegister.Value
claimedRegis.Display.SurfaceGui.playerName.Text = "Claim Register"
claimedRegis.Display.SurfaceGui.ImageLabel.Image = " "
claimedRegis.Display.SurfaceGui.ImageLabel.ImageTransparency = 1
claimedRegis.Prompt.ProximityPrompt.Enable = true
claimedRegis.Prompt.ProximityPrompt.ActionText = "Claim"
plr.ClaimedRegister.Value = nil
end)