Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 10 years ago

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

Log in to vote
0
Answered by 10 years ago

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.

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. SchonATL 15 — 10y
0
Okay, I'll edit it. systematicaddict 295 — 10y
0
Edited. systematicaddict 295 — 10y
Ad

Answer this question