The goal is simple, have a text-label move from the bottom of a frame to the top using tweening.
When ever i press F to toggle it, it gives off this error Unable to cast string to token (line 43)
Not sure what the issue is, so i hope someone can help.
while true do
wait()
closestPart = returnClosestPart(torso.Position, preferredDistance)
if closestPart then
script.Parent.Visible = true
script.Parent.Text = "Press 'F' To Collect From "..closestPart.Name
UserInput.InputBegan:connect(function(input,gameProcessed)
local prompt = script.Parent.Parent.Inventprompt
local promptText = prompt.nameprompt
if input.KeyCode == Enum.KeyCode.F then
promptText.Text = closestPart.Contents.item.Value.." Collected"
promptText.Visible = true
promptText:TweenPosition(UDim2.new(0,0,0,0), 'out', 'Linear')
end
end)
else script.Parent.Visible = false
end
end
Memes

3 comments
First it is good practice to use Enums instead of the string or number value to avoid these kind of issues. It should be 'Out' not 'out' as it is case sensitive, you have also not given the tween a time.
promptText:TweenPosition(UDim2.new(0,0,0,0), 'out', 'Linear') should be promptText:TweenPosition(UDim2.new(0,0,0,0), 'Out', 'Linear', 1)
promptext.Position:TweenPosition***