How to disable a StarterScript if a player is touching a part?

Hello! I want to disable a script in StarterPlayerScripts for a player, but only if the player is touching a part. If the player is outside, then it will re-enable. I’m a bit new to scripting so I don’t know how to do it… Any feedback is appreciated!

Couldnt you just use Enabled?

Example.Touched:connect(function()
 ExScript.Enabled = false
end)
1 Like

I think enabling and disabling is good but I want it to disable when the player is touching a part, and enable when the player stops touching

use TouchEnded to achieve that.

1 Like

do u wannt to disable the script or the starerplayerscripts ??, if script then what is the scrit name ??

1 Like

the script
the script name is CustomControlScript

1 Like

this musst be working!

local CCS = game.StarterPlayer.StarterPlayerScripts:FindFirstChild("CustomControlScript")


script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid")then
		CCS.Enabled = false
		
		wait(0.5)
	end
	
end)
script.Parent.TouchEnded:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		CCS.Enabled = true
	end
	
end)
1 Like

I don’t think you can get the starter player just like that. It won’t work

or this


local starterplayer = game:GetService("StarterPlayer")

local CCS = starterplayer.StarterPlayerScripts:FindFirstChild("CustomControlScript")



script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid")then
		CCS.Enabled = false
		
		wait(0.5)
	end
	
end)
script.Parent.TouchEnded:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		CCS.Enabled = true
	end
	
end)
1 Like

Also doesn’t work. I’m telling you, its not as easy as that. I want to get it to only affect the player that is touching the part, not all players in the game.

then maybe a local script?? hmm , local script is for client…

1 Like

i will, give u a local script, script and paste it and tell me if it works okay ?

1 Like