I have an bug that im not sure how to fix

i have an bug that im not sure how to fix

2 Likes
local replacedstorage = game:GetService("ReplicatedStorage")
local claimprox = script.Parent.Parent.ProximityPrompt
local door = script.Parent.Parent.Parent.Parent.door.door
local name = script.Parent.Parent.name.Value
local model = door.Parent.Parent.Parent.Parent.STORE1
local text = model.Sign.Sign.SurfaceGui

local claim = replacedstorage:WaitForChild("ClaimBooth")
local unclaim = replacedstorage:WaitForChild("UnClaimBooth")

door.CanCollide = true

claimprox.Triggered:Connect(function(plr)

	local claimBooth = plr.ClaimedBooth

	if claimBooth.Value	== nil then

		claimprox.Enabled = false
		claimBooth.Value = model
		text.TextLabel.Text = plr.Name .. "'s store"
		door.CanCollide = false
		name = plr.Name

		claim:FireClient(plr, model)
	elseif claimBooth.Value == model then
		claimprox.Enabled = true
		
		claimBooth.Value = nil
		claimprox.ActionText = "Claim!"
		text.TextLabel.Text = "UNCLAIMED!"
		door.CanCollide = true
		name = nil
		
	end
end)

this is an code inside an proximty prompt

local claim = game.ReplicatedStorage:WaitForChild("ClaimBooth")

claim.OnClientEvent:Connect(function(model)
	local prox = model.Door.door.door.ProximityPrompt
	prox.Enabled = true
	prox.ActionText = "Unclaim!"
end)

and this is an local script inside startergui

the bug is that when i claim and unclaim it works but when i try claim and unclaim the action text remain unclaim

You are not checking whether they have claimed or not you are just straight away setting the actionText to “unclaim!”

try this:

local replacedstorage = game:GetService("ReplicatedStorage")
local claimprox = script.Parent.Parent.ProximityPrompt
local door = script.Parent.Parent.Parent.Parent.door.door
local name = script.Parent.Parent.name.Value
local model = door.Parent.Parent.Parent.Parent.STORE1
local text = model.Sign.Sign.SurfaceGui

local claim = replacedstorage:WaitForChild("ClaimBooth")
local unclaim = replacedstorage:WaitForChild("UnClaimBooth")

door.CanCollide = true

claimprox.Triggered:Connect(function(plr)

	local claimBooth = plr.ClaimedBooth

	if claimBooth.Value	== nil then

		claimprox.Enabled = false
		claimBooth.Value = model
		text.TextLabel.Text = plr.Name .. "'s store"
                prox.ActionText = "Unclaim!"
		door.CanCollide = false
		name = plr.Name

		claim:FireClient(plr, model)
	elseif claimBooth.Value == model then
		claimprox.Enabled = true
		
		claimBooth.Value = nil
		claimprox.ActionText = "Claim!"
		text.TextLabel.Text = "UNCLAIMED!"
                prox.ActionText = "Claim!"
		door.CanCollide = true
		name = nil
		
	end
end)

sorry for the bad formatting

1 Like

why are you using prox its not what it called

here it is apparently

if not then your code is unclear

yeah im not good making scripts organized

i call it in the script claimprox

Then, copy the script, and then replace prox with claimprox. Simple.

so your saying that i shoud make the actiontext not in the local script else on the server?

whichever you want. keep in mind tho that if you do it on the server all players will see the change. to make only the stall’s owner see the change, use a localscript with the same if statements.

yes its working thenk you
yay yay

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.