✓ Accepted answer
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
##Fixed 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
##Recommendation(s)
- Use HumanoidRootPart when working with events like this, because let's say an R15 rig joins the game it wouldn't work because R15 don't have a torso
- FindFirstChild is better (in this case) because WaitForChild yeilds until the thread exits whilst FindFirstChild finds the child of the given instance immediately unlike WaitForChild.
##JesseSong
1 comment
remember to parent the explosion or else it won't work. Here's a guide on explosions: https://www.youtube.com/watch?v=Rj-_cjGfCCY