How can i make a script inside a proximity prompt make all local scripts inside all players characters enabled?

  1. I made a camera thaat uses a proximity prompt and when you trigger the proximity prompt it gives you night vision access

  2. the night vision access works only for the client

  3. i tried fixing it but i dont know how

game.Workspace.Clicks.ClickParts.ProximityPromptee.Triggered:Connect(function(plr)
game.Workspace.KeyHitbox:Destroy()
game.StarterPlayer.StarterCharacterScripts.LocalScript.Script:Destroy()
game.StarterPlayer.StarterCharacterScripts.LocalScript.Enabler.Enabled = true
game.Workspace.Clicks.ClickParts:Destroy()
plr.Character.LocalScript.Enabler.Enabled = true
task.wait(0.1)
plr.Character.LocalScript.Script:Destroy()
end)

this script is inside a local script

bro

What happens

I’m pretty sure you can’t delete the Script from a LocalScript incase thats relevant. Are there any errors in console?

use game:GetPlayers() and then activate all children of players that are local scripts

you can use this to enable every local script inside the players folder

for _,plr in game.Players:GetPlayers() do
	for _,i in plr:GetDescendants() do
		if i:IsA("LocalScript") and i.Enabled == false then
			i.Enabled = true -- activate all the local sripts inside all players
		end
	end
end

it loops through all players and loops through every descendant inside those players if it is a local script and disabled then it will enable it
if you know where the local scripts that you want to disable would be then you can reference it and get its children instead that would be more optimized

Note: you need to do this script inside a server script

2 Likes

the script doesent work. I put it in server script service and i tried changing the script but it doesent work. What do i do now?

1 Like

i made it to enable any local script inside the Players folder not inside the players character

if ur using local scripts inside starter character then try this instead of the first one


for _,plr in game.Players:GetPlayers() do
	for _,i in plr.Character:GetDescendants() do
		if i:IsA("LocalScript") and i.Enabled == false then
			i.Enabled = true -- activate all the local sripts inside all players
		end
	end
end

i already tried this earlier and it didnt work

this is a new one not the first script that i sent

yes it doesent work i tested it again

did you run it when the player activated the proximity prompt ?

no i dont have errors in the console. Maybe i missed a step?

maybe you ran it before the players character load did you run it in a server script instantly or u ran it when the player activated the prompt?

wait let me try with the prompt because i just put it in the server script service without it being triggered. Im trying it now

i tested it and it enabled all the starter character scripts for me if it still didnot work add task.wait(3) at the top if your using it in prompt then no need for task.wait()

it doesent work… Is it maybe because i have more enabled false scripts?

ssssss

no it should still work even if you have enabled scripts

no i mean in my LocalScript that is not enabled, i have 3 more not enabled scripts. Maybe its because of that?

run this in server without the prompt just for test and use task.wait

task.wait(5)

for _,plr in game.Players:GetPlayers() do
	for _,i in plr.Character:GetDescendants() do
		if i:IsA("LocalScript") and i.Enabled == false then
			i.Enabled = true -- activate all the local sripts inside all players
			print(i)
		end
	end
end

it should print after 5 seconds and disable all scripts

no i tried it with over 10 local disabled scripts and still worked it will work even if you have 9999 local scripts