I have a script that makes a part revolve around the player. But, at the same time, I want the part to bounce up and down. I have tried to tween the part individually and have tried to use a variable that represents the Y axis.
LocalScript:
local event = game.ReplicatedStorage.Client.SSAGenerated
local char = game.Players.LocalPlayer.Character
local head = char:FindFirstChild("Head")
event.OnClientEvent:Connect(function()
local SeverStorage = game:GetService("ServerStorage")
local StarUncloned = workspace.PassiveStar
local Star = StarUncloned:Clone()
Star.Parent = game.Players.LocalPlayer.Character
Star.Position = game.Players.LocalPlayer.Character:FindFirstChild("Head").Position
Star.Orientation = Vector3.new(0,0,0)
local FullCircle = 2 * math.pi
local radius = 3
local function getXAndZPositions(angle)
local x = math.cos(angle) * radius
local z = math.sin(angle) * radius
return x, z
end
for Time = 0,100,0.01 do
local angle = Time * (FullCircle / 1.2)
local x, z = getXAndZPositions(angle)
local position1 = (head.CFrame * CFrame.new(x,0,z)).p
Star.CFrame = CFrame.new(position1)
task.wait()
end
end)