Ok so I made this skill script and the skill works but if won remove when the skill is done. I put in a remove command but it doesn't work, so can someone help? The script is below if you need it.
Player = game.Players.LocalPlayer Char = Player.Character Torso = Char.Torso Mouse = Player:GetMouse() function Move(key) key = key:lower() if key == "z" then print ("z was pressed") game.Players.LocalPlayer.Character.Torso.Anchored = true for i = 1, 100, 3 do Move = Instance.new("Part") Move.Parent = Workspace Move.Size = Vector3.new(math.random(4,6), math.random(4,6), math.random(4,6)) Move.Anchored = true Move.TopSurface = 0 Move.BottomSurface = 0 Move.BrickColor = BrickColor.new("Brown") Move.CanCollide = false game.Players.LocalPlayer.Character.Torso.Anchored = false y = Instance.new("BodyVelocity") y.maxForce = Vector3.new(math.huge, math.huge, math.huge) y.velocity = Player.Character.Torso.CFrame.lookVector*80 Move.Parent = Workspace y.Parent = Move Move.CFrame = Player.Character.Torso.CFrame*CFrame.new (0, 0, -12)*CFrame.new (0,0,-i)CFrame.Angles(math.random(), math.random(), math.random()) Move.Touched:connect(function (hit) humanoid = hit.Parent:findFirstChild("Humanoid") if humanoid and humanoid ~= Player.Character.Humanoid then Hitting = Instance.new("ObjectValue") Hitting.Value = Player Hitting.Name = "creator" Hitting.Parent = humanoid Move.Parent = game.Workspace humanoid:TakeDamage(5) Move:Remove() wait(0.2) Hitting:Remove() end end) wait() end end end Mouse.KeyDown:connect(Move)
I dont think you can put a function into something like that, if i were you I would make a seperate script and clone it into the part with that inside it :)
You created the function like this:
function Move(key)
But in the script, you also used "Move" as a local for a new Part in Workspace:
Move = Instance.new("Part")
So, maybe that is the problem?
Move:Remove() is depreciated. It's more modern to use the method :destroy() because it is a much more effective deletion of a part. However, I don't think that is the entire problem..I'm not really too sure. Switching these words out is definitely something to try. Also, you don't know that Hitting still exists after that wait(0.2). Things happen. I would personally make sure that Hitting exists (if Hitting then Hitting:destroy() end). Something else I noticed; why did you put Move into workspace twice? I know this is trivial but it just bugged me so I thought I'd point it out xD.