So I've created a script that sizes a group of parts proportional to the distance the player is from a certain part. The script works like this:
First I specify the player and the player's character (when it has loaded).
Next, I Activate a function that loops around a certain code block. The Code block itself...
- Creates an iteration (iterates through children in workspace)
- Finds Objects that are "Parts" and have a rotation value of 45,0,45
- Finds the distance between that part and the characters torso MINUS that part and the SpawningPad in that area (all using the magnitude property of a Vector3 value
- Sets the size of that part by setting each axis (of Vector3 value) as the distance that we just calculated above
The script is Local , and is located in the StarterPlayerScripts folder of the player. I have FilteringEnabled ON.
Here's the script:
player = game.Players.LocalPlayer
function SizeCubes(character)
repeat wait() until character.Torso.CFrame ~= nil
while player ~= nil and character ~= nil and character.Humanoid.Health ~= 0 do
wait()
local GetDistance
for i,v in pairs(workspace:GetChildren()) do
if v.ClassName == "Part" and v.Rotation == Vector3.new(45,0,45) then
GetDistance = ((v.Position - workspace.SpawnPad.Position).magnitude) - ((character.Torso.CFrame.p - v.Position).magnitude)
v.Size = Vector3.new(GetDistance,GetDistance,GetDistance)
end
end
end
end
player.CharacterAdded:connect(function(character)
repeat wait() until character.Torso.CFrame ~= nil
SizeCubes(character)
end)
SizeCubes(player.Character)
So the main thing I'm getting at here is that it works on studio mode, but not online.
Yeah, yeah I've read the article on this problem, I'll read it again. But for now I want to focus on how you can create/edit local parts, obviously from a local script.
-Anyways, if you see any problems with my script alone, please add a comment. Otherwise, I'd like a detailed explanation on this concept, and maybe even an answer. THX!

1 comment
Is StreamingEnabled true in the Workspace? If so, it might be that some parts there are not replicated from the server to the client when you want them to be.