Help to fix script

hello, I made a script when you touch the desk, it gives you statistics, but I have 2 problems 1 of them I want to make sure that when the player stood on the desk, he was given strength and not always ran to the desk and got off it and 2 problem I would like to make it so that when the player stood on the desk, he did not I was able to use the endurance tool well, as I could not, I would like that when a player uses his tool, he was not given a boost, otherwise consider he will get x2 strength I will be grateful to everyone for help here is the script itself


script.Parent.Touched:Connect(function(hit)
	local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
	
	if player then
		if delay == false then
		player.Endurance.Value += 1e90

		delay = true
		wait(1)
		delay = false
		elseif delay == true then
			
	end
  end
end)
4 Likes

with 1 problem I want that when the player stood on the part he was given a boost and then I have a touch

2 Likes

for me, when a player stands on a piece, he is given a boost 1 time, and I would like to do when he stands on a piece, a boost was given

3 Likes

It’s really hard for me to understand what you are trying to say.

Could you write the problems in a simple term and use bulleted list? I’ll still try to understand the problem better. Ill update this when I do find a possible solution.

Problem 1

Try using variables to determine who touched the part and who ended the touch. Create a table of the players in the zone using this.Using this you can probably use a loop to give all those players the required stats.

There are more ways but for now I’ll stick with this. But you can also try region3

2 Likes

Sorry for the translator 1.I want when the player stood on the part, he got a boost, and not went down and got on it 2. I want when a player uses their tool, the item they couldn’t get a boost from it

3 Likes

Don’t worry about it. Here is what I understood tho the subjects still aren’t clear:

  1. When a player stands on “the” part, he gets a certain boost and not when gets out and gets back on it.

  2. When a player uses their tool (assuming he is standing on that same part) he wouldn’t get that boost.

Is this what you are trying to say? Or is it something else?

Some other questions
  1. Is it like, you touch a part to get the boost and it’s not like if you are standing on it you can’t get it repeatedly or is it like you have to stand on the part to continuously get that boost repeatedly. Like how a sell circle works in certain games?
2 Likes

yes that’s exactly what I’d like to do

2 Likes

One last question.

Do you have a variable inside the player that defines if the player has / using the boost?
Cause I think u mean at the first problem that he can’t get another boost if he already has one. Or if one is already active.

Or is it like these specific parts give one boost for everyone if they touch it. And they can get it back every 1 hour or something?

2 Likes

No problems the script works You can try to test it yourself

1 Like

Yea I know that, Although I don’t understand the problem here. I’ll try to write some codes according to the problem you’ve mentioned. I’ll write 2 different codes and send it to you when I can. And see if that’s what you are looking for.

1 Like

Have you played a super power fighting simulator?

1 Like

Yes, I have. Do you mean you want something like a power pick up:

You can’t pick the power again once you’ve already got it.
Or you can but you’ll have to wait for a certain time limit.

This means that when u pick it others can’t either.

1 Like

There’s a system where you stand on a piece and you’re given a boost, and when you pick up a tool, you don’t get a boost from it

1 Like

So what you are telling me is that is you have a weapon on you, you can’t pick up the endurance boost cause it’s a melee type? But the melee type is also a weapon (tool)

1 Like

Let me give you an example of how I would like to do?

1 Like

Yes that would help me a bunch. Thank you

1 Like

https://youtu.be/3sV-x7veXZc Here is the link to the video

1 Like

I don’t get it, are you telling that you want a system like that?

1 Like

Yes, I made this system: when you stand on a part, you are given a boost, and when you pick up a tool, you do not get a boost from the tool

1 Like

I think I understand what you are trying to say. Ill reply you in 3 hours probably. But the code I will provide may not be what you are looking for I think if so I am sorry but I’ll try my best.

1 Like