Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I make audio play if the players goes high enough?

Hi, I'm trying to make a space game like KSP. I want to make space currently, I want to know how I can make everything else from spawn disappear and make the earth appear plus playing music and setting skybox to space.

I know, this is just one script for music, but I think I can do the sky myself.

local plr = game.Players.LocalPlayer
local char = plr.Character


while true do
	wait(.01)
	if char.Position.Y >= 19700 then
		workspace.Space:Play()
	else
		workspace.Space:Stop()
	end
end

1 comment

1

Wait, so your the one making KSP 2?? I never new it was coming to roblox! (99% a joke comment)

1 answer

✓ Accepted answer

Just change the while true do loop to:

while true do
	repeat wait() until char.HumanoidRootPart.Position >= 19700
	workspace.Space:Play()
	repeat wait() until char.HumanoidRootPart.Position < 19700
	workspace.Space:Stop()
end

The issue was that Models (including the player's character) don't have a Position property.

This discussion is preserved as it was. New answers, comments, and votes are closed.