In the simplest way to explain this I am trying to get a model to move up and down (A floating effect).
But for some reason there isnt an error and it also doesnt move the part.
I have added prints statements so I can assure you that the code is running past Tween:Play()
Am I setting the CFrame wrong?
Heres the code
local ReplicatedStorage = game:GetService("ReplicatedStorage")
for i,v in pairs(workspace:WaitForChild("Spawners"):GetDescendants()) do
if v.Name == "Spawner" then
for j,m in pairs(ReplicatedStorage:WaitForChild("Weapons"):GetChildren()) do
if v.Parent.Name == m.Name then
local NumberOfChildren = m:GetChildren()
local ChosenWeaponIndex = math.random(1, #NumberOfChildren)
local ChosenWeaponObject = NumberOfChildren[ChosenWeaponIndex]
local ClonedWeapon = ChosenWeaponObject:Clone()
ClonedWeapon.Name = "ChosenWeapon"
ClonedWeapon:SetPrimaryPartCFrame(v.PrimaryPart.CFrame + Vector3.new(0, 5, 0))
ClonedWeapon.Parent = v
local TweenData = TweenInfo.new(2, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, math.huge, true)
local TweenGoal = {CFrame = v.PrimaryPart.CFrame + Vector3.new(0, 3, 0)}
local Tween = game:GetService("TweenService"):Create(ClonedWeapon.PrimaryPart, TweenData, TweenGoal)
Tween:Play()
end
end
end
end
Does anyone have any ideas? Thank you for your time :)
The part that isnt working is the Tween section where I do all the tweening, everything above it works fine.
