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

How do I make an image button that can find the player who clicked it?

Asked by
Plieax 66
7 years ago
Edited 7 years ago

This is what I have on my script right now. What i want it to do is make the folder value be true only if the file this is activated. But when I run this in my game it instantly makes the folder value true. How do I fix this?

01local this = script.Parent
02 
03game.Players.PlayerAdded:connect (function(plr)
04 
05        local folder = Instance.new ("BoolValue",workspace)
06        folder.Name = (plr.Name .. "click")
07 
08        if this.Activated then
09            folder.Value = true
10        end
11end)
0
'this' is the button that you press Plieax 66 — 7y
0
what is the script a parent of? it can help people to help you 4PlayerGamingRoblox 38 — 7y
0
You can't use ":connect()". Use ":Connect()". D3LTA_Y 72 — 7y

2 answers

Log in to vote
1
Answered by 7 years ago

You don't handle PlayerAdded from a LocalScript. Just use a LocalScript and use the LocalPlayer.

1--LocalScript
2 
3script.Parent.MouseButton1Click:Connect(function()
4    print(game:GetService("Players").LocalPlayer.Name)
5end)
0
localscript jesus GingeyLol 338 — 7y
Ad
Log in to vote
0
Answered by
D3LTA_Y 72
7 years ago

Organization is essential.

01--Made by Lunatic_o
02-- I don't know if it will work. (I'm on mobile)
03 
04local this = script.Parent
05this.Activated = false
06 
07function CheckThis()
08 
09      if assert(this.Activated) then
10            print("This is Activated")
11            workspace.YoutFolder.Value = true
12      end
13end
14 
15 
View all 25 lines...

Answer this question