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

Unable to cast string to token, gui tweening error?

Asked by
Nickoakz 231 Moderation Voter
8 years ago
local client
client['MessageTweenAnimate']={"Top","Bottom","Sine","Out"}; 
bg:TweenPosition(
    UDim2.new(0,0,0,0),
    client.MessageTweenAnimate[3],
    client.MessageTweenAnimate[4],
    .8,
    true
)

Error: Unable to cast string to token. Script ' --- ' Line 3 - field ?

Should I use numbers instead?

1 answer

Log in to vote
1
Answered by 8 years ago

It might help a bit if we knew what bg was, but I think I see your issue.

I'm not sure if I'm right, I can't test my theory since I can't get ROBLOX Studio to work at this time. But I'm pretty sure that went you call for client.MessageTweenAnimate You need to do client["MessageTweenAnimate"][3] Or you could do something like this:

local MessageTweenAnimate = {
    "Top", --Assuming "Top" and "Bottom" are positions? I don't think "Top" and "Bottom" are in :TweenPosition() arguments.
    "Bottom",
    "Sine",
    "Out"
}

bg:TweenPosition(UDim2.new(0, 0, 0, 0), MessageTweenAnimate[4], MessageTweenAnimate[5], 0.8, true)

Another issue is you used "Sine" first and then used "Out". It's the other way around. You need to define the direction, and THEN you can define the style. Also, if bg is a ScreenGui, then it won't work. Tweening positions and sizes only works on Gui elements like TextBoxes, TextLabels, TextButtons, ImageLabels, Frames, ScrollingFrames, ImageButtons, etc.

Ad

Answer this question