So I have a script where it gets all the children from the iceicles model when the sword is swung and its just the part where the icicles go around the players to surround it the code block im trying to do it in is the function called icePopup()

with that code it just puts all of them in the same position

local ServerStorage = game:GetService("ServerStorage")
local Icicles = ServerStorage:FindFirstChild("Icicles")

local Tool = script.Parent
local SlashSound = Tool.SwordSlash
local Handle = Tool.Handle
local Blade = Tool.Blade

local Debounce = false
local PlayersHit = {}

function icePopup(Hrp)
	Times_To_Power += 1
	local iceClone = Icicles:Clone()
	iceClone.Parent = workspace.IceDebris
	
	if Hrp then
		for i, mesh in pairs(iceClone:GetChildren()) do
			mesh.CFrame = Hrp.CFrame 
		end
	end
end

Tool.Activated:Connect(function()
	if Debounce == false then
		Debounce = true
				
		local Humanoid = Tool.Parent:WaitForChild("Humanoid")
		local HumanoidRootPart = Tool.Parent:WaitForChild("HumanoidRootPart")
		local SwordAnim = script.SlashAnim
		SlashSound:Play()
		
		icePopup(HumanoidRootPart)
		
		local SwordTrack = Humanoid:LoadAnimation(SwordAnim)
		SwordTrack:Play()
		
		task.wait(.4)
		Debounce = false
	end
end)

Blade.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") and hit.Parent ~= Tool.Parent then
		if Debounce and PlayersHit[hit.Parent] == nil then
			hit.Parent:FindFirstChild("Humanoid"):TakeDamage(20)
			
			PlayersHit[hit.Parent] = true
			task.wait(.4)
			PlayersHit[hit.Parent] = nil
		end
	end
end)

3 comments

0

i think that the problem is that when you run the game, the script can't find the icicles model

0

because when you run a game, if you try to return anything in ServerScripterService or ServerStorage, it just won't be there

0

its spawning all the icicles i checked the workspace