How do I change the Y level of multiple instances?
What I’ve got:
local plr = game.Players.LocalPlayer
local CloudF = game.Workspace.Clouds
local char = plr.Character
local essence = plr:WaitForChild("leaderstats"):WaitForChild("Essence") --Just to make sure the are loaded
while true do
local Clouds = CloudF:GetChildren()
Clouds.CFrame.Y = (plr.leaderstats.Essence.Value / 25) + 3.5
wait()
end
local plr = game.Players.LocalPlayer
local CloudF = game.Workspace.Clouds
local char = plr.Character
local essence = plr:WaitForChild("leaderstats"):WaitForChild("Essence") --Just to make sure the are loaded
while true do
local Clouds = CloudF:GetChildren()
for _,v in Clouds do
v.Position += Vector3.new(0,(plr.leaderstats.Essence.Value / 25) + 3.5,0)
end
wait()
end
This is perfect! Well almost perfect… v.Position += Vector3.new(0,(plr.leaderstats.Essence.Value / 25),0 adds the value instead of setting it, causing the clouds to ascend to the heavens I tried using = instead of += but they just started glitching out even more. Thoughts?
local plr = game.Players.LocalPlayer
local CloudF = game.Workspace.Clouds
local char = plr.Character
local essence = plr:WaitForChild("leaderstats"):WaitForChild("Essence") --Just to make sure the are loaded
while task.wait() do
local Clouds = CloudF:GetChildren()
for _,v in Clouds do
v.Position = Vector3.new(0,(plr.leaderstats.Essence.Value / 25) + 3.5,0)
end
end
Unfortunately not, this causes them to get put at the correct height, but also at x = 0 and z = 0. We need the 0’s copy v’s x and z position. So all thats needed to do is make 2 variables as v’s x and z and use that in the position. Quick question though how do I access that value (forgot if it was cframe or position or what lol)
You can get the X or Z from the v.Position like this:
local plr = game.Players.LocalPlayer
local CloudF = game.Workspace.Clouds
local char = plr.Character
local essence = plr:WaitForChild("leaderstats"):WaitForChild("Essence") --Just to make sure the are loaded
while task.wait() do
local Clouds = CloudF:GetChildren()
for _,v in Clouds do
local x = v.Position.X
local z = v.Position.Z
v.Position = Vector3.new(x,(plr.leaderstats.Essence.Value / 25) + 3.5,z)
end
end