I need a Gui for my Pokemon game that opens up and offers the option of sending a battle request to the other player.
What I have so far:
local player = script.Parent.Parent m = player:GetMouse() m.Button1Down:connect(function() if m.Target then if m.Target.Parent then local user = Game.Players:GetPlayerFromCharacter(m.Target.Parent) if user and user ~= player then -- Checks to see if the player is clicking on another player local c = user.Character if (player.Character.Torso.Position - c.Torso.Position).magnitude < 20 then local bg = Instance.new("BillboardGui",c.Head) bg.Adornee = c.Head bg.Size=UDim2.new(1,0,1,0) bg.StudsOffset = Vector3.new(3,0,0) bg.Name = "Interact" game.Lighting.Interacting:Clone().Parent = bg bg.Interacting.Text = user.Name end end end end end)
Does not work. Please help.
Put in every player's torso, it should be a local script.
local Torso = script.Parent local Click = Instance.new("ClickDetector",Torso) Click.Name = "Hue" Click.MaxActivationDistance = 15 -- Studs away to be able to click. Click.MouseClick:connect(function(PlayerWhoClicked) --Take it from here please. end)