Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Simple onButton1Down() function not working?

Asked by 8 years ago

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
":Connect" should be ":connect" with a lowercase 'c' BlueImagination 45 — 8y
0
Thank you so much!!! Gwolflover 80 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago
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.

Ad

Answer this question