So here is the problem after the player dies my "Fireball" script stops working.. Script:
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:wait()
local Ready = true
function onKeyPress(actionName, userInputState, inputObject)
if userInputState == Enum.UserInputState.Begin and Ready then
Ready = false
local FireBall = game.ReplicatedStorage.FireBall
local FireBallClone = FireBall:Clone()
FireBallClone.Parent = game.Workspace
FireBallClone.CFrame = Character.HumanoidRootPart.CFrame*CFrame.new(0, 1, -3)
local PV = Instance.new("BodyVelocity")
PV.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
PV.Velocity = Character.HumanoidRootPart.CFrame.lookVector*30
PV.Parent = FireBallClone
local Debounce = true
FireBallClone.Touched:connect(function(part)
if part.Parent:FindFirstChild("Humanoid") and Debounce then
part.Parent.Humanoid:TakeDamage(25)
Debounce = false
end
end)
wait(1.5)
Ready = true
wait(0.5)
FireBallClone:Destroy()
end
end
game.ContextActionService:BindAction("keyPress", onKeyPress, false, Enum.KeyCode.E)
Here's the output after dying
HumanoidRootPart is not a valid member of Model
08:57:33.478 - Stack Begin
08:57:33.479 - Script 'Players.Blob_y.PlayerScripts.LocalScript', Line 16
08:57:33.479 - Stack End
08:57:33.480 - ContextActionService: Unexpected error while invoking callback: HumanoidRootPart is not a valid member of Model
New to scripting any help would be appreciated
