Need help with ContextActionService

I am trying to give a tool to the player who clicked the button but it gives me an error

The code:

local plr = game:Getservice("Players")
local Rep = game:GetService("ReplicatedStorage")
local Context = game:GetService("ContextActionService")

local function Buttons(Player)
	local Tool = Rep.HyperlaserGun:Clone()
	Tool.Parent = plr.LocalPlayer.Backpack
end

local Playerr = Instance.new("Player")
Buttons(Playerr)

Context:BindAction("MB",Buttons,true,Enum.KeyCode.T)
Context:SetPosition("MB",UDim2.new(1,-70,0,10))
Context:SetTitle("MB","Get tool")

The error:
a2

This is illegal to do (permission error). I think that you should try getting the player, who clicked the button not by creating a new player object.

1 Like

Thanks! your solution did work like I want them to.