wait(5) local function explode() local player = game.Players.LocalPlayer repeat wait(0.1) until player.Character local handle = player.Character:WaitForChild("Torso") local explosion = Instance.new("Explosion") explosion.Position = handle.Position print("Exploded") end explode()
I know the cause of issue, it counts character nil because it hasnt loading in yet, but I dont know how to fix it
Problem:
There's no need of the wait on line 1, since the player would already have been in the game. I can't see any really see any errors within your code but try this code
local function explode() local player = game.Players.LocalPlayer repeat wait() until player.Character local handle = player.Character:FindFirstChild("HumanoidRootPart") local explosion = Instance.new("Explosion") explosion.Position = handle.Position print("Exploded") end explode()
Ensure this is a LocalScript placed in StarterPlayer < StarterPlayerScripts