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

TextButton not responding to anything?

Asked by 4 years ago
Edited 4 years ago

I'm making a game and right now I've made a TextButton of course. For some reason when I click it, it won't fire the print. Even if I hover my mouse over it won't darken as it's supposed to. I've checked my code multiple times for bugs. I've even tried remaking the script and the TextButton. Here's my code in case there are bugs.

local Button = script.Parent.TextButton

Button.MouseButton1Up:Connect(function()
    print ("Success so far!")
end)
0
MouseButton1Up fires upon the release of the left-trigger, though it behaves similarly, the actual Signal responsible for click-detection on UI Instances, is MouseButton1Click. Ensure you're using the appropriate script (LocalScript) Ziffixture 6913 — 4y
0
Yes I am Penguin_Dveloper -4 — 4y

2 answers

Log in to vote
2
Answered by
DemGame 271 Moderation Voter
4 years ago

In your code, everything up to line 3 is right. Instead of writing "MouseButton1Up", try writing "MouseButton1Click" instead. Here is your edited code:

local Button = script.Parent.TextButton

Button.MouseButton1Click:Connect(function()
    print("Success so far!")
end)
Ad
Log in to vote
-1
Answered by 4 years ago
Edited 4 years ago
-- Services
local UserInputService = game:GetService("UserInputService")

-- GUI Elements
-- your gui code bla bla bla

-- Player's Mouse
local mouse = game.Players.LocalPlayer:GetMouse()

-- Global boolean indicating whether player's MouseButton1 is down
local hold = false

function
-- code bla bla bla
if hold == false then return end
-- work off this ^
-- clode bla bla
end

also why tf do you have a space in print

0
because you have to or else it won't work =\ Penguin_Dveloper -4 — 4y
0
Dramatic_Dromo is obviously not telling the truth iNot_here 93 — 4y
0
Your code is terrible as well m8 ;] Ziffixture 6913 — 4y
0
The Lua interpreter is whitespace insensitive. It does not matter how far the parentheses trail ahead of the function; if the context remains legitimate execution will not be affected. Ziffixture 6913 — 4y

Answer this question