any idea why my local script is changing everybody's skybox instead of only the player who touches the part? this is a LocalScript in StarterCharacterScripts
local skybox = game:GetService("Lighting").Sky game.Workspace.SkyboxTriggers.LotL.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player ~= nil then skybox.SkyboxUp = "rbxassetid://6115435142" skybox.SkyboxDn = "rbxassetid://6115431284" skybox.SkyboxBk = "rbxassetid://6115432902" skybox.SkyboxFt = "rbxassetid://6115433855" skybox.SkyboxLf = "rbxassetid://6115430469" skybox.SkyboxRt = "rbxassetid://6115432137" end end end)
When the player touches the Part called "LotL" the skybox changes as intended, but for every player. The server does not see this change.
Use A Remote Event To Change The Sky Box For That Player.
Script 1:
game.Workspace.SkyboxTriggers.LotL.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player ~= nil then game.ReplicatedStorage:FindFirstChild("EventName"):FireClient(player) end end end)
Local Script 2:
local skybox = game:GetService("Lighting").Sky game.ReplicatedStorage:FindFirstChild("EventName").OnClientEvent:Connect(function() skybox.SkyboxUp = "rbxassetid://6115435142" skybox.SkyboxDn = "rbxassetid://6115431284" skybox.SkyboxFt = "rbxassetid://6115433855" skybox.SkyboxLf = "rbxassetid://6115430469" skybox.SkyboxRt = "rbxassetid://6115432137" end end end)