I am trying to move rigs to a position after an event is fired, but when I try to move them using cframes, it won’t work.
Here is the code for firing the event with the arguments.
battleEvent:FireClient(player, player.Units:GetChildren(), {{Vector3.new(0, 2.5, -5), "Evil Noob", "Evil Noob", "Evil Noob"}, {Vector3.new(0, 2.5, -10), "Special Grade Curse", "Special Grade Curse", "Special Grade Curse"}}, "None", script.Parent)
Here is the code for handling the event in the local script.
for i, enemySet in pairs(enemyUnits) do
-- print(battlePosition.CFrame * CFrame.new(enemySet[1]))
local battleBaseOffSet = battlePosition.CFrame * CFrame.new(enemySet[1])
table.remove(enemySet, 1)
for _, enemyUnit in pairs(enemySet) do
local enemyModel = RS.Enemies[enemyUnit]:Clone()
enemyModel.Parent = battleFolder
local randx = math.random(-7, 7)
local randz = math.random(-7, 7)
local battleOffset = battleBaseOffSet * CFrame.new(randx, 0, randz)
enemyModel.HumanoidRootPart.CFrame = battleOffSet
-- effects (not important)
local highlight = Instance.new("Highlight")
highlight.FillTransparency = 0
highlight.OutlineTransparency = 1
highlight.FillColor = Color3.new(0, 0, 0)
highlight.Parent = enemyModel
local tween = TweenService:Create(highlight, tweenInfo, {FillTransparency = 1})
tween:Play()
local spawnVFX = RS.VFX.SpawnEffect:Clone()
spawnVFX.Parent = enemyModel
spawnVFX.CFrame = enemyModel.Torso.CFrame
task.wait(0.001)
spawnVFX.Attachment.Electric:Emit(3)
spawnVFX.Attachment.Force:Emit(2)
spawnVFX.Attachment.Force2:Emit(2)
spawnVFX.Attachment.Smoke:Emit(3)
spawnVFX.Attachment.Specs:Emit(5)
Debris:AddItem(spawnVFX, 2)
print(Vector3.new(randx, 0, randz))
end
end
The enemy units table is the table containing the unit placement information.
The main goal is to make them appear in a place that is a random offset from another set position.