You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
im trying the make this cool effect of having a sphere fade into existence around the player
- What is the issue? Include screenshots / videos if possible!
The code ive written is VERY laggy, even on a high(ish) end PC, and i have 0 idea how to make it alot less laggy
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
things such as lowering the size works quiet easily, but that ruins the point of it in general, and since my question is so specific, theres no posts on it
.
.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local function Sphere(center, radius, numSegments)
local workspace = game.Workspace
local segmentAngle = math.pi / numSegments
local fadewait = 0
for theta = 0, math.pi, segmentAngle do
local sinTheta = math.sin(theta)
local cosTheta = math.cos(theta)
for phi = 0, 2 * math.pi, segmentAngle do
local sinPhi = math.sin(phi)
local cosPhi = math.cos(phi)
local x = radius * sinTheta * cosPhi
local y = radius * cosTheta
local z = radius * sinTheta * sinPhi
local part = Instance.new("Part")
part.Size = Vector3.new(1, 1, 1)
part.Position = center + Vector3.new(x, y, z)
part.CFrame = CFrame.new(part.Position,center)
part.Anchored = true
part.Transparency = 1
part.Material = Enum.Material.Neon
part.Color = Color3.new(0,0,0)
part.Parent = workspace
task.delay(fadewait,function()
TS:Create(part,TweenInfo.new(1),{Transparency = 0}):Play()
end)
end
fadewait+=0.1
end
end
local centerPosition = HRP.Position
local sphereRadius = 50
local e = sphereRadius/10
local segments = 32*e
Sphere(centerPosition, sphereRadius, segments)
(some variables may need to be supplied yourself for testing)
im also taking other ways of making this effect entirely if there is any!
Thanks for any assistance