Local sound issue

Sure ill go pull it up real quick brb

this would be taking you to one of the worlds


local branch2 = workspace.nighttree
local sound = workspace.songs.mirrorworld
local wind = workspace.songs["Long Wind Loop"]

local function ToMirrorWorld(hit)
	
	if sound.IsPlaying == true then else
		sound:Play()
	end
	wind:Stop()
	game.Lighting.TimeOfDay = "06:00:00"
	hit.Parent:moveTo(workspace.mirrorspawn.Position)
	workspace.treelight6.SurfaceLight.Brightness = 15
	game.Lighting.Atmosphere.Density = 0.4
	
	-- disable other trees
	game.StarterPlayer.StarterPlayerScripts.spaceobbystart.Disabled = true
	game.StarterPlayer.StarterPlayerScripts.beachskyobbystart.Disabled = true
	game.StarterPlayer.StarterPlayerScripts.snowworldenter.Disabled = true
	game.StarterPlayer.StarterPlayerScripts.mazeworldentrance.Disabled = true
	game.StarterPlayer.StarterPlayerScripts.DeepSpaceSpeed.Disabled = true
	
	
	
	
end

branch2.Touched:Connect(ToMirrorWorld())

By the looks of it you never check if it is the local player who warps to the new world, which results in the music playing for all the clients.

1 Like

that actually does make alot of senseā€¦how would I go about doing that? I just assumed localscripts would make it local on its own lol

Add this line at the top of the function:

if hit.Parent ~= game.Players.LocalPlayer.Character then return end

1 Like

okay im going to test that right now but I have a feeling youā€™ve solved it. brb

I tried that but it made the script not run anymore. I did this:

local branch2 = workspace.nighttree
local sound = workspace.songs.mirrorworld
local wind = workspace.songs["Long Wind Loop"]

local function ToMirrorWorld(hit)
	if hit.Parent ~= game.Players.LocalPlayer.Character then return end
	
	if sound.IsPlaying == true then else
		sound:Play()
	end
	wind:Stop()
	game.Lighting.TimeOfDay = "06:00:00"
	hit.Parent:moveTo(workspace.mirrorspawn.Position)
	workspace.treelight6.SurfaceLight.Brightness = 15
	game.Lighting.Atmosphere.Density = 0.4
	
	-- disable other trees
	game.StarterPlayer.StarterPlayerScripts.spaceobbystart.Disabled = true
	game.StarterPlayer.StarterPlayerScripts.beachskyobbystart.Disabled = true
	game.StarterPlayer.StarterPlayerScripts.snowworldenter.Disabled = true
	game.StarterPlayer.StarterPlayerScripts.mazeworldentrance.Disabled = true
	game.StarterPlayer.StarterPlayerScripts.DeepSpaceSpeed.Disabled = true
	
	
	
	
end

branch2.Touched:Connect(ToMirrorWorld())

Does it error or does the pad just not work? Just to make sure aswell, you added it right under local function ToMirrorWorld(hit)?

1 Like

it returned no error message and yeah thats correct. If it helps, this script is under starterplayerscripts.

Thatā€™s strange. I would expect it to work but well, try adding this at the top of the function, just to test:

print(hit:GetFullName())

Show what it outputs

1 Like

okay will do. Brb. and thanks for being patient and helping me out itā€™s been a journey lol.

Oh I realized I made a typo when I was trying your first suggestion so iā€™m going to retry that now that I fixed the typo, sorry about that brb

okay your first suggestion worked perfectly seriously thank you.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.