Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Is this examine script theoretically possible?

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

2 comments

0

Of course this is possible.

0

Yes. You are going in the right direction. If you want to stick with using the Mouse object, you may want to listen to the Button2Down event: http://wiki.roblox.com/index.php?title=API:Class/Mouse/Button2Down. And, of course, you'll need to do :FindFirstChild("IntValue") on the target.

1 answer

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

2 comments

0

The answer section is not for the Questioner to use, it is where you question will obviously be answered, Do not post here with another question on answers, either edit your question or comment bellow it.

0

sorry, its just that usually when I comment I don't get a response back, and I can't fit code into a comment, but I'll try editing my original post

This discussion is preserved as it was. New answers, comments, and votes are closed.