I have the script for the soldier I just need help for the cloning part.
Right now, when I test the ability, the soldier summons in the wrong location and I need it to be at the current location the player is at.
-- CLONE SCRIPT btw
local event = game:GetService("ReplicatedStorage").BugleCombo
local plr = game.Players.PlayerAdded:Wait()
local char = plr.Character or plr.CharacterAdded:Wait()
local pos = char:WaitForChild("HumanoidRootPart").CFrame
event.OnServerEvent:Connect(function()
local clone = game:GetService("ReplicatedStorage"):WaitForChild("Soldier"):Clone()
clone.Parent = workspace
clone:WaitForChild("HumanoidRootPart").CFrame = pos
wait(4)
clone:Destroy()
end)
If you are attempting to clone the player, be aware that the first parameter of OnServerEvent will always be the player who sent the signal to the server.
event.OnServerEvent:Connect(function(player)
local char = player.Character
if char then
local pos = char:WaitForChild("HumanoidRootPart").CFrame
local clone = game:GetService("ReplicatedStorage"):WaitForChild("Soldier"):Clone()
clone.Parent = workspace
clone:WaitForChild("HumanoidRootPart").CFrame = pos
wait(4)
clone:Destroy()
else
warn("No character found for "..player.Name)
end
end)