So i’m trying to make a bomb that the player can shoot. But for some reason the bomb goes through stuff even though everything has collisions on including the bomb. I have 2 scripts, 1 server script and 1 local script.
local script:
local mouse = game.Players.LocalPlayer:GetMouse()
local Bomb = script.Parent
local ThrowEvent = Bomb:WaitForChild("ThrowEvent")
Bomb.Activated:Connect(function()
ThrowEvent:FireServer(mouse.Hit.p, mouse.Hit.LookVector)
end)
server script:
local Bomb = script.Parent
local Handle = Bomb.Handle
local TweenService = game:GetService("TweenService")
local Info = TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 4, true, 0)
local Goals = {
Color = Color3.fromRGB(171, 25, 25)
}
local ColorTick = TweenService:Create(Handle, Info, Goals)
local ThrowPower = 202
local function TimeBombTick()
for ChangeColor = 1, 4, 1 do
ColorTick:Play()
end
end
local ThrowEvent = Bomb:WaitForChild("ThrowEvent")
ThrowEvent.OnServerEvent:Connect(function(Player, Mousepos, MouseVector)
local Humanoid = Bomb.Parent:FindFirstChildWhichIsA("Humanoid")
local Animator = Humanoid:FindFirstChildOfClass("Animator")
if Animator then
Handle.Parent = workspace
local ThrowAnim = script.Parent.Animations.ThrowAnimation
Bomb:Destroy()
local ThrowAnimationTrack = Animator:LoadAnimation(ThrowAnim)
ThrowAnimationTrack:Play()
TimeBombTick()
ColorTick.Completed:Connect(function()
local Explosion = Instance.new("Explosion", workspace)
Explosion.Position = Handle.Position
Explosion.DestroyJointRadiusPercent = 0
Handle:Destroy()
end)
wait(0.18)
Handle.AssemblyLinearVelocity = MouseVector * ThrowPower
wait(1)
Handle.AssemblyLinearVelocity = Vector3.new(0,0,0)
end
end)
Any help would be appreciated. Thanks!