I'm trying to make a script that will make it so that when a player right-clicks any part with an "examine" intValue in it, a box pops up that has text in it. I've been trying to do this but with no luck. Here's what I have so far but I may be doing the completely incorrect thing to make this happen. Am I going in the right direction? Also this script is inside an importer script that puts this script into PlayerScripts when a player enters the game.
local sGui=script.ScreenGui local frame=sGui.Frame local player=game.Players.LocalPlayer local mouse=player:GetMouse() local function onRightClick() local targ=mouse.Target frame.Visible=true end
So Should I use (part) as an argument for onButton2Down() to tell it that I want the function to happen when a part is right clicked? This is what I have so far
local sGui=script.ScreenGui local frame=sGui.Frame local player=game.Players.LocalPlayer local mouse=player:GetMouse() local function onButton2Down(part) local targ=mouse.Target if part:FindFirstChild("examine")~= nil then frame.Visible=true end end