Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make it so when a player clicks a block, a frame pops up for 10 seconds?

That may have been hard to understand, let me try to make it clearer. I need (really want) it where when a player clicks a block (using ClickDetector?), a frame shows for 10 seconds. Now that I think about it, I think I got it clear enough in the title. Oh well. This is what I've got so far (please understand I'm terrible at scripting so this may be completely wrong..)

function onClicked (mouse)
script.Parent.Parent.Parent.Parent.StarterGui.ScreenGui1.Frame1.Visible = true
wait (10)
script.Parent.Parent.Parent.Parent.StarterGui.ScreenGui1.Frame1.Visible = false
end
script.Parent.ClickDetector.MouseClick:c­onnect(onClicked)

1 answer

✓ Accepted answer

Try this.

script.Parent.ClickDetector.MouseClick:connect(function(p)
	repeat wait(1/30) until p.PlayerGui and p.Character
	p.Character.Humanoid:TakeDamage(50)
	p.PlayerGui.ScreenGui1.Frame1.Visible = true
	wait(10)
	p.PlayerGui.ScreenGui1.Frame1.Visible = false
end)

In TakeDamage(50), change 50 to however much damage you want the player to take.

3 comments

0

Okay, that one worked great. But could you help me with one last thing? I need it to apply damage to the player that clicked it as well.

0

Okay, I'll edit it.

0

Edited.

This discussion is preserved as it was. New answers, comments, and votes are closed.