So I made a script that, when a player touches a part, their screen fades, Lighting properties are changed, and the player is teleported. It all works just fine when only one player is involved, but the problem comes in when there are multiple players. If one player touches the part, all other players’ screens fade, the Lighting properties are changed, and they teleport. What makes this so confusing to me is that it’s a local script, and inside of StarterCharacterScripts, so I have no idea how this is even possible.
Code:
while wait() do
local OLParams = OverlapParams.new()
local touchingParts = workspace:GetPartsInPart(workspace.Start.StartFadeBox, OLParams)
for _, part in pairs(touchingParts) do
if part.Parent:FindFirstChild("Humanoid") then
hum.WalkSpeed = 0
Tween:Create(plr.PlayerGui.ScreenGui.Fade, TweenInfo.new(3, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, 0, false, 0), {BackgroundTransparency = 0}):Play()
wait(3)
char.Torso.Velocity = Vector3.new(0, 0, 0)
char.HumanoidRootPart.CFrame = workspace.S1.TeleportStart.CFrame
game.Lighting.Brightness = 1.5
game.Lighting.FogColor = Color3.fromRGB(128, 136, 147)
game.Lighting.FogEnd = 200
game.Lighting.Ambient = Color3.fromRGB(92, 95, 103)
game.Lighting.OutdoorAmbient = Color3.fromRGB(92, 95, 103)
game.Lighting.SunRays.Enabled = true
wait(3)
Tween:Create(plr.PlayerGui.ScreenGui.Fade, TweenInfo.new(6, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, 0, false, 0), {BackgroundTransparency = 1}):Play()
wait(7)
hum.WalkSpeed = 16
wait(0.1)
break
end
end
end
I’ve been scripting for over a year, and I have never had a problem like this. There are no errors or anything of the sort either. If somebody could explain this to me, I would greatly appreciate it.