What do you want to achieve? Fix the error I am receiving.
What is the issue? Debris doesn’t eliminate body velocity however returns it is unable to cast the object
What solutions have you tried so far? I have searched in the devforum about the error and nothing seems familiar to what is happening to me
local TweenService = game:GetService("TweenService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local DebrisService = game:GetService("Debris")
local SpiderFolder = ReplicatedStorage:WaitForChild("Advanced Spider")
local Event = SpiderFolder:WaitForChild("Base"):WaitForChild("Events"):WaitForChild("Web Yank")
Event.OnServerEvent:Connect(function(Player)
local Character = Player.Character or Player.CharacterAdded:Wait()
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
local Humanoid = Character:WaitForChild("Humanoid")
local UsingMove = Character.UsingMove
local Stunned = Character.Stunned
local Blocking = Character.Blocking
local Ragdolled = Character.Ragdolled
if UsingMove.Value == true or Stunned.Value == true or Blocking.Value == true or Ragdolled.Value == true then return end
UsingMove.Value = true
local UpperCut = Humanoid.Animator:LoadAnimation(script.Uppercut)
UpperCut:Play()
local Part1 = Instance.new("Part")
Part1.Parent = workspace
Part1.Name = "UpperCutHitbox"
Part1.Anchored = false
Part1.CanCollide = false
Part1.Size = Vector3.new(9, 5.5, 9)
Part1.CFrame = HumanoidRootPart.CFrame + HumanoidRootPart.CFrame.LookVector * 3
Part1.Transparency = .5
local Weld = Instance.new("Weld")
Weld.Parent = Part1
Weld.Part0 = Part1
Weld.Part1 = HumanoidRootPart
local con
con = Part1.Touched:Connect(function(hit)
local enemy = hit.Parent:FindFirstChild("Humanoid")
if hit.Parent == Character then return end
if enemy then
con:Disconnect()
enemy.Parent.Stunned.Value = true
local UpVelocity = Instance.new("BodyVelocity", enemy.Parent.HumanoidRootPart)
UpVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
UpVelocity = hit.Parent.HumanoidRootPart.CFrame.UpVector * 65
game.Debris:AddItem(UpVelocity, .5)
end
end)
end)
The error says “Unable to cast value to Object” at game.Debris:AddItem(UpVelocity, .5)
Thanks a lot! However, I’m having a slight problem on something. (I added this after posting this)
local TweenService = game:GetService("TweenService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local DebrisService = game:GetService("Debris")
local SpiderFolder = ReplicatedStorage:WaitForChild("Advanced Spider")
local Event = SpiderFolder:WaitForChild("Base"):WaitForChild("Events"):WaitForChild("Web Yank")
Event.OnServerEvent:Connect(function(Player)
local Character = Player.Character or Player.CharacterAdded:Wait()
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
local Humanoid = Character:WaitForChild("Humanoid")
local UsingMove = Character.UsingMove
local Stunned = Character.Stunned
local Blocking = Character.Blocking
local Ragdolled = Character.Ragdolled
if UsingMove.Value == true or Stunned.Value == true or Blocking.Value == true or Ragdolled.Value == true then return end
UsingMove.Value = true
local UpperCut = Humanoid.Animator:LoadAnimation(script.Uppercut)
UpperCut:Play()
local Part1 = Instance.new("Part")
Part1.Parent = workspace
Part1.Name = "UpperCutHitbox"
Part1.Anchored = false
Part1.CanCollide = false
Part1.Size = Vector3.new(9, 5.5, 9)
Part1.CFrame = HumanoidRootPart.CFrame + HumanoidRootPart.CFrame.LookVector * 3
Part1.Transparency = .5
local Weld = Instance.new("Weld")
Weld.Parent = Part1
Weld.Part0 = Part1
Weld.Part1 = HumanoidRootPart
local con
con = Part1.Touched:Connect(function(hit)
local enemy = hit.Parent:FindFirstChild("Humanoid")
if hit.Parent == Character then return end
if enemy then
con:Disconnect()
local Beam = SpiderFolder:WaitForChild("Base"):WaitForChild("Effects"):WaitForChild("Beam"):WaitForChild("Beam"):Clone()
Beam.Parent = HumanoidRootPart
if Beam then -- made for testing (since it was not working)
Beam.Enabled = false
Beam.Enabled = true
end
local One = SpiderFolder:WaitForChild("Base"):WaitForChild("Effects"):WaitForChild("Beam"):WaitForChild("One"):Clone()
One.Parent = HumanoidRootPart
local Two = SpiderFolder:WaitForChild("Base"):WaitForChild("Effects"):WaitForChild("Beam"):WaitForChild("Two"):Clone()
Two.Parent = enemy.Parent.HumanoidRootPart
enemy.Parent.Stunned.Value = true
local UpVelocity = Instance.new("BodyVelocity", hit.Parent.HumanoidRootPart)
UpVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
UpVelocity.Velocity = hit.Parent.HumanoidRootPart.CFrame.UpVector * 35
DebrisService:AddItem(UpVelocity, .5)
end
end)
end)
I don’t know if this is a problem or if I did this wrong but why is my beam not showing?