How to make if player touched he value will set to 2 and don't reset if don't moving? (reseting on touch ended)

Script

inPart = false

local waitSec = 4

script.Parent.Touched:Connect(function(hit)
	local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
	if not inPart then
		print(player.leaderstat.Multi.Value)
		player.leaderstat.Multi.Value = 2
	
		inPart = true		

		wait(waitSec)		

		inPart = true
	end
end)

script.Parent.TouchEnded:Connect(function(hit)
	local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
	if inPart then
		print('End')

		wait(waitSec)
		inPart = not inPart
		player.leaderstat.Multi.Value = 1
	end
end)

:heart:

If you want your script just to give the value once then try:script.Parent.YourScriptName.Disabled = true
Maybe it will work

It looks how i need but not, if the player touched the part gives 1 time if touch ended the value reseting to the any number. but the script spam the console.

Try putting script.Parent.Remove() in the end of the script well if you don’t need to use the script anymore

End of script or ended touch, touched?

Try both i would put it in the end

Do you speak russian or ukrainian or another?

But from what I am understanding is that touch ended is giving you issues, Use a magnitude check instead of touched and touchended. :slight_smile: