This is a LocalScript I made that makes a single player's screen fade white in and out when touching a part, and it works just fine, until another player goes in and activates the script themselves and now the script doesn't work for the next person. Can anybody find out what's up with it?
db = true
function onTouch(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if db == true and humanoid ~= nil then
db = false
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
wait(0.01)
player.PlayerGui.FadeGui.Frame.BackgroundTransparency = 0.9
-- rest of the otherwise perfectly fine code goes here
wait(0.1)
db = true
end
end
workspace.Teleportation.BeginTeleport.Touched:Connect(onTouch)

2 comments
Ok. I already did so I edited it
Can you show the rest of the script then?