How would I make a decal appear on the screen when a player clicks?

Its all good! I was in your position not long ago. Can you add TextLabel to the 3rd line next to screenGui?

This is what is inside my tool.

Screen Shot 2020-04-09 at 11.51.01

1 Like

And, you do not need to add the Mouse.Button1Down as it will then show the gui even if the tool isnt equipped. So get rid of Line 2.

1 Like

I put it as an Image Label rather than text.

1 Like

Screen Shot 2020-04-09 at 11.53.23

Is this better? I noticed the tool and wait are underlined though

u should do a tool as a variable

local tool = game.StarterPack.Weight -- this could be different, idk ur path...

and correct form for wait is:

wait(1)  --without a space

Thanks. I’ve done the whole script now but still nothing appears when I click.

Screen Shot 2020-04-09 at 11.59.05

Wait is underlined because in Wait, the w is not capital letter. it’s small letter.

wait(1)

1 Like

remember the studio is case sensitive so de capitalize wait (is that even a word lol) and define some variables.

This sets it in StarterGui, every other player will see it but the player who clicks will not see it. It is better to don’t give scripts if you don’t know what it does.

Now from the topic, You can make a GUI from the PlayerGui visible, and then set any text you want.

1 Like

also u should store ur tool into StarterPack(if u want to use it streight away) or ServerStorage(if u do that, then u need much more scripting later)

1 Like

Sorry, i dont really understand what you said

So what am I supposed to do now? I am so confused lol.
This is what my tool and gui looks like:
Screen Shot 2020-04-09 at 12.03.15

And this is what my script looks like:

Screen Shot 2020-04-09 at 12.03.39

After you defined it you didnt drop down a line. Make sure to do that or the script wont function properly

Also, if the local script is a child of the tool, just define it like this:

local tool = script.Parent 
tool.Activated:Connect(function()
-- the Gui script here
end)
local tool = script.Parent
tool.Activated:Connect(function()
    game.StarterGui.ScreenGui.ImageLabel.Visible = true
    wait(1)
    game.StarterGui.ScreenGui.ImageLabel.Visible = false
end)

maybe like that?

It didn’t work. Something is stopping the image from showing.

1 Like

Are there any issues in the output you could show us?

1 Like

So basically i think you are saying that when you hold a certain tool and click, an image label would be visible.

You could do:

local db = true -- adding a denounce to prevent spam
tool = script.Parent -- making a variable for the tool.
tool.Activated:Connect(function()
if db == true then -- checking if you can click again
db = false -- making it so you can't click anymore
      game.Players.LocalPlayer.PlayerGui.ScreenGui.ImageLabel.Visible  = true -- making it visible (I am getting it from the localplayer)
wait(1)
game.Players.LocalPlayer.PlayerGui.ScreenGui.ImageLabel.Visible = false -- making it invisible
db = true -- after one second you would then be able to click again
end
end)
2 Likes

66 posts were split to a new topic: How would I make a decal appear (discussion)