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

How to change the skybox depending on the place where the player is?

Asked by 3 years ago

Hello ! I would like to know if it is possible to change the skybox depending on where the player is (but only for the player who touches a certain part for example) ... It is a game that uses teleportation and I wondering if it was possible without changing the place ?? Thank you in advance !

1 answer

Log in to vote
0
Answered by
ud2v3cf 35
3 years ago

I would use Region3. First, you create the Region3 with the boundaries of a part. The part will be zones.

local region = Region3.new(zone.Position - zone.Size/2, zone.Position + zone.Size/2)

Next, you use the built-in FindPartsInRegion3 to get a list of parts inside that region.

local parts = workspace:FindPartsInRegion3(region, {
    -- any parts inside here will be EXCLUDED
})

NOTE: The maximum parts (by default) that will be given back will be 20. Simply add a 3rd argument if you want to increase or decrease. Now, you just check is any of the character's descendants is inside the parts array. If so, you change the skybox. Be sure to put it in a loop.

0
The skybox will be changed for all the players ? Or for just the player inside the "region" ?? KingAquitain 35 — 3y
0
Just the player. ud2v3cf 35 — 3y
0
Okay Ill test it KingAquitain 35 — 3y
0
Oh, Can u please give me a script ? Because I tested everything I could but I did not succeed KingAquitain 35 — 3y
Ad

Answer this question