How to do a "Click Part To Claim"

You can write your topic however you want, but you need to answer these questions:
Hi. I want to make a part where you click it claims it(but they can’t claim another thing)

I tried finding tutorials, but most of them are buttons or touch. I am still learning how to script, so I’m sorry if you think this is simple or wasting time. Thank you anyways!

This game is not for a tycoon or simulator. It is for a recruiting game(inspired)

I am not asking for the script, I just simply want to know what to do. If you do give it to me which I think is not likely, thank you.

You can make a script check if a player has already claimed something

You can probably use a BoolValue to check. like if a Boolean value is put into the char / player and it’s set to false.

The script checks the bool value and if it’s false, the script sets it to true and allows them to claim it, while if the boolvalue is true, that means they already claimed it and the script does nothing more.

1 Like

Ok, Thank you for the help! :smiley:

I feel like a bad for asking this, I did a click detector because it doing a part, then I made an actual Boolean in the script, I don’t know to check it though…

local Part = game.Workspace.Part1
local ClickDetector = Part.ClickDetector
local Billboard = Part.BillboardGui
local TextLabel = Billboard.TextLabel
local claimed = false

Part.ClickDetector.MouseClick:Connect(function(player)
	claimed = true
	
	if claimed == true then
		
	end
end)

(Please don’t judge me for how bad I am…)

is there an error? it would be much easier to understand if you could provide that.
also, you might want to make it so that if claimed == false then at the start, to prevent the claimed = true from running again.

although, if you are connecting the function to the player, you should do something like

Local Claimed = instance.new("NumberValue")
Claimed.Name = "Claimed"
Claimed.Parent = player
Claimed.Value = 0
--under the function, then make the following script into
If Claimed.Value == 0 then
Claimed.Value == 1
if Claimed.Value == 1 then
            end
      end
end)

please report back if this script has any errors so I can help troubleshoot.

1 Like

Ok so, I don’t know if the “end)” is supposed to be there and player is not defined. I also might be off soon so sorry about that

a full script would look something like this, if the script was under the click detector.

script.Parent.MouseClick:Connect(function(player)
If Claimed == nil then
local Claimed = Instance.new("NumberValue")
Claimed.Name = "Claimed"
Claimed.Value = 0
Claimed.Parent = player
if Claimed.Value == 0 then
Claimed.Value = 1
if Claimed.Value == 1 then
                  end
            end
      end
end)

if the other one had errors, this is probably your best fix.
it has to be a script that is parented to the click detector, and if you want it to be in serverscriptservice, set up a variable for the clickdetector.

1 Like

i just posted a fix. see if that works then report any bugs you might have!

1 Like

also check output for any errors!

1 Like

I dont have any errors so far :smiley:

Check the players during a test play, and check if the value is created under the person aswell as putting another one of those scripts under that part with clickdetector, e.t.c, you get it.

if you want the color or transparency to change there are plenty of tutorials on that!
if you have any more errors after that than come back here! if not than glad to help you!

1 Like

How do I make it so it can’t claim the part again?

There are multiple capital letters in the wrong place. The first if statement has a capital i, the first local has a capital L

1 Like

Yeah I fixed them, I thought they were just grammar habits which I have sometimes.

for not being able to claim the part again? just make an if statement to the part after the variables. i did one that detected if the claiming was nil, then it would do the entire script, but if it wasn’t nil, it would end