Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago

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
Wait, so your the one making KSP 2?? I never new it was coming to roblox! (99% a joke comment) BashGuy10 384 — 4y

1 answer

Log in to vote
1
Answered by
Asceylos 562 Moderation Voter
4 years ago
Edited 4 years ago

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.

Ad

Answer this question