Hello, I am currently trying to make a special for some sword class or whatever its called for a game. I wanted it to be like a charge attack then clones of the player spawn and attack the players inside the range. I searched on the DevForum, and I saw some code that should allow :GetTouchingParts() on CanCollide off. I forgot who created the code, because I closed the tab earlier, so I apologize, but even though there is dunmmies in the range, and it should be printing, most of the time it doesn’t. If anyone is able to help me on this I’d appreciate it. Thanks!
Heres a video that shows that the dummies are inside of the part: https://streamable.com/7hg6o2
And here is the code:
specialTwo.OnServerEvent:Connect(function(player)
local newSphere = sphere:Clone()
newSphere.Position = player.Character.PrimaryPart.Position
newSphere.Lightning.Enabled = true
newSphere.Parent = workspace.Zone
local newTween = tweenService:Create(newSphere, tweenInfo, goals)
newTween:Play()
newTween.Completed:Wait()
local function GetTouchingParts(part)
local connection = part.Touched:Connect(function() end)
local results = part:GetTouchingParts()
connection:Disconnect()
return results
end
local plrs = GetTouchingParts(newSphere)
for i,v in pairs(plrs) do
if v.Parent:FindFirstChild("Humanoid") then
print(v.Name)
local player = game.Players:GetPlayerFromCharacter(v.Parent)
if player then
disableControls:FireClient(player)
end
local clone = CloneAtk:Clone()
clone.Parent = workspace
clone.PrimaryPart.Position = v.Parent.PrimaryPart.Position + Vector3.new(0,0,-3)
end
end
end)
(GetTouchingParts function was not made by me, like I said earlier I do not know who the original creator is
)