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

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

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

✓ Accepted answer

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.

4 comments

0

The skybox will be changed for all the players ? Or for just the player inside the "region" ??

0

Just the player.

0

Okay Ill test it

0

Oh, Can u please give me a script ? Because I tested everything I could but I did not succeed

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