Problem with GUI tweening and parameters. How can I fix it?
Asked by
4 years ago Edited 4 years ago
So, I have made a function that does GUI tweening, with 1 of the parameters representing the GUI that gets tweened. I tried putting the parameter in a variable.
Here is the script:
01 | local ReplicatedStorage = game:GetService( "ReplicatedStorage" ) |
02 | local remoteEvent = ReplicatedStorage:WaitForChild( "CannonGuiAppear" ) |
04 | remoteEvent.OnClientEvent:Connect( function () |
05 | local GUI = script.Parent.Parent.PlayerGui [ "Cannon-Popup" ] |
06 | local function GuiTween(gui,posX, poxY) |
09 | UDim 2. new(posX, 0 , poxY, 0 ), |
14 | game.Workspace.Cannon.Part.Controls.Disabled = = false |
18 | GuiTween(GUI.Frame 1 , 0.62 , 0.898 ) |
19 | GuiTween(GUI.Frame 2 , 0.261 , 0.929 ) |
20 | GuiTween(GUI.Frame 3 , 0.318 , 0.898 ) |
21 | GuiTween(GUI.Frame 4 , 0.62 , 0.929 ) |
22 | GuiTween(GUI.Frame 5 , 0.357 , 0.859 ) |
23 | GuiTween(GUI.TextLabel, 0.357 , 0.88 ) |
And here is the error:
17:09:07.156 - Unable to cast value to function
for the line that says;
gui:TweenPosition(
Any idea how I can fix this? And yes, the remote event CAN run without issue of triggering it.
Note: This is a local script in StarterPlayerScripts (transferred to PlayerScripts in each player)