My code looks like this:
function opengui(click, click2) print(click) print(click2) --local kiosk = script.Parent.Parent.Parent.Parent.Parent --local shopgui = kiosk:FindFirstChild("ShopGui") --local guiclone = shopgui:clone() --guiclone.Parent = click.PlayerGui end script.Parent.MouseButton1Down:connect(opengui)
click and click2 are both being printed out as numbers, that seem to be player position related. How do I get the player that clicked it, like I can with .Touched:connect?
Your parameters 'click' and 'click2' are being printed out as numbers because the MouseButton1Down
event, the event you're using, returns two things;
The event does not return the player that clicks.. so what you need to do is **make this a localscript ** and index LocalPlayer
from game.Players
.
local plr = game.Players.LocalPlayer --The player function opengui(click, click2) local kiosk = script.Parent.Parent.Parent.Parent.Parent.ShopGui shopgui:Clone().Parent = plr.PlayerGui end script.Parent.MouseButton1Down:connect(opengui)