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

Gui not firing function on player input fix?

Asked by 7 years ago
Edited 7 years ago

I created a keypad in ro studio and it worked fine but when I tested it in a roblox server it didn't work, just a note I am using surface GUIs and my game is filtering enabled.

script for button 1:

local text = script.Parent.Parent.Parent.Parent.screen.Gui.Top.TextLabel
local debounce = false

script.Parent.MouseButton1Down:connect(function()
    if debounce == false then
        debounce = true
        local num = script.Parent.Name
        text.Text = text.Text..num
        debounce = false
    end
end)

The script is inside a surface gui and the game is filtering enabled but when I turn filtering enabled off it works perfectly fine.

Thank you in advance

1 answer

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago
local text = script.Parent.Parent.Parent.Parent.screen.Gui.Top.TextLabel
local debounce = false

script.Parent.MouseButton1Down:connect(function()
    if debounce == false then
        debounce = true
        local num = script.Parent.Name --This is the line I changed
        text.Text = text.Text..num
        debounce = false
    end
end)

So you did script.Parent.MouseButton1Down, so my understanding is that it is some type of button. And on the line that I indicated above, you put 'tostring(script.Parent)' which means you are trying to turn an object into a script, which isn't possible. I think you meant to put 'tostring(script.Parent.Name)', which gets the name (a string) of the object. But since you are using a name, it is already a string so no need to do 'tostring()'. Hope I helped!

0
still didn't work User#16405 0 — 7y
0
i added some more information on my question User#16405 0 — 7y
0
the game is filtering enabled aswell User#16405 0 — 7y
Ad

Answer this question