-
What do you want to achieve? Link global function to button
-
What is the issue? I tried to create map styled teleport, but doesn’t show teleport window.
This is original code that console saying “Not function”:
-- Original: Frozengaia's TeleportGUI
local panels = script.Parent
local pgui = panels.Parent.Parent
local IsStudio = game:GetService("RunService"):IsStudio()
local button
panels.Parent:WaitForChild("buttonFlame")
button = panels.Parent.buttonFlame:WaitForChild("Tele")
function calling()
print("Called")
end
button.Activated:Connect(calling())
-
What solutions have you tried so far? I
used this variation, but console says not linked actually.
button.Activated:Connect(function()
print("Main for Tele")
end)
You’re calling the function when you put it in the Connect
, remove the ()
to pass in the function itself
If you need a more visible example
button.Activated:Connect(calling)
4 Likes
You should write as button.Activated:Connect(calling)
Credit @EmbatTheHybrid for the solution as she posted first
1 Like
Thank you. Now time for real issue.
Button is in other flame.
local buttons=script.Parent
local stele=buttons:WaitForChild("ShortcutTele")
buttons.buttonFlame.Tele.Activated:Connect(function()
print("Trying")
stele.masterScript.calling()
end)
ShortcutTele.masterScript(Script) is script in #1.
You can’t call an external function like that as calling
is exclusive to that script only, you may need to use something like a BindableFunction that you invoke from other scripts
1 Like
BindableFunction is new to see. I’ll check it.