What I want to do is have an explosion trigger 5 seconds after someone sits in a seat. The only thing I need help with is what trigger or function to use. This is the explosion.
local explosionPart = script.Parent local explosion = Instance.new("Explosion", game.Workspace) explosion.Position = explosionPart.Position explosionPart:Destroy()
The script is inside of the part I want to explode (a computer screen)
local explosionPart = script.Parent local explosion = Instance.new("Explosion") script.Parent.Touched:Connect(function(hit) -- Detects a player if hit.Parent:FindFirstChild("Humanoid") ~= nil then local Hum = hit.Parent:WaitForChild("Humanoid") if Hum.Sit == true then explosion.Parent = explosionPart explosionPart:Destroy() end end end) -- Hope I helped
or if upper ones don't work try this one, most likely that the second code will work:
local explosionPart = script.Parent local explosion = Instance.new("Explosion") game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) local Hum = character:WaitForChild("Humanoid") Hum.Seated:Connnect(function(isSeated, seat) if seat == explosionPart and isSeated then explosion.Parent = explosionPart explosionPart:Destroy() end end) end) end) -- Hope I helped*2