How can I make the UI visible with executing the ability. I use UI.visibility(ForseOn). UI doesn't appear but there are no errors.
You can use the code below to enable the visibility of a UI object with the casting of an ability. This code requires two custom properties:
"UI": A core object reference to your UI object
"UIAbility": a core object reference to the ability object you will use to make the UI visibile
--A core object reference your UI object local UI = script:GetCustomProperty("UI"):WaitForObject() --A core object reference to an ability object that you will use enable the UI local UIAbility = script:GetCustomProperty("UIAbility"):WaitForObject() --function that will be called when the ability is cast function OnCast(ability) --Force the "UI" to become visibile UI.visibility = Visibility.FORCE_ON end --Connect the "OnCast" function to the "castEvent" of the "UIAbility" UIAbility.castEvent:Connect(OnCast)
local uiTask = script:GetChildren()
uiTask.visibility = Visibility.FORCE_ON
Would't it work like this?
Help me please!!!
I can"t understand this, Why can't I call an object by name or by identifier?
You can access an object by its name or ID using
--Get a Core Object based on its name local object = World.FindObjectByName("Name of the object") --Get a Core Object based on its ID local object = World.FindObjectById("Id of object")
However, you will then need to keep a strict naming system for all objects. Using core object reference custom properties instead allows you to drag and drop objects and change their names without issues:
I would suggest watching this video:
Core Object Custom Properties