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

Simple onButton1Down() function not working?

What is wrong with this onButton1Down() function? Its supposed to fire when anything in the game is clicked on but it doesn't. What am i doing wrong?

local sGui=script.ScreenGui
local frame=sGui.Frame
local player=game.Players.LocalPlayer
local mouse=player:GetMouse()
local pGui = script.Parent.Parent.PlayerGui

local function onButton1Down()
    local targ=mouse.Target
	
--if part:FindFirstChild("examine")~= nil 
	--then 
	--sGui.Parent = pGui
   -- frame.Visible=true
	print("success")
--else 
--	print("fail")
--end


 
end
mouse.Button1Down:Connect(onButton1Down)

2 comments

2

":Connect" should be ":connect" with a lowercase 'c'

0

Thank you so much!!!

1 answer

local sGui=script.ScreenGui
local frame=sGui.Frame
local player=game.Players.LocalPlayer
local mouse=player:GetMouse()
local pGui = script.Parent.Parent.PlayerGui

function onButton1Down()
    local targ=mouse.Target

--if part:FindFirstChild("examine")~= nil 
    --then 
    --sGui.Parent = pGui
   -- frame.Visible=true
    print("success")
--else 
--  print("fail")
--end



end
mouse.Button1Down:Connect(onButton1Down)

Here you go.

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