Tools getting disabled for multiple players

For some reason my script for my jail disables all players tools, I only want it to disable it for the player who touches the part. Is there any way to fix this?

Image:

It looks like you are using a localscript for this, this happens because you are not verifying who touched the part, so it thinks that everyone should be affected

A great post was made about this issue and how to remedy it

Basically you need at least some sort of verification to make it work, example

local part = script.Parent

part.Touched:Connect(function(hit)
    part.Transparency = 1
end)

Here still will make it invisible for everyone if one person touches it, but if we do

local part = script.Parent

local plr = game:GetService("Players").LocalPlayer

part.Touched:Connect(function(hit)
	if not plr.Character or not hit:IsDescendantOf(plr.Character) then return end
    part.Transparency = 1
end)

This does work for the player who touches it but not everyone else because we verified who touched it

2 Likes

Where would I put this in my script?

I gave you a brief way to verify touches, you have to change it around for your code

I was looking for this in my game, I appreciate the help!
Works well! :smiley:

1 Like

Glad I could help out another person whilst trying to help another haha!

1 Like

So, if I am doing this right, would it work?

Image:

Yes, but you forgot to write hit in the function()

I edited it, should it work now?

1 Like

Yes, should work, try it out and see how it goes!

Thank you so much, it works perfectly!

1 Like

Anytime! if you have anymore issues don’t be afraid to make another post!