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

Tween Error, Attempt to call table value?

Asked by 3 years ago

Error

Players.The_Saver31.PlayerGui.Fade.LocalScript:5: attempt to call a table value

Script

local TweenService = game:GetService("TweenService")
local Duration = 5
local played = false

local Fade = TweenService:Create(script.Parent.Frame, TweenInfo(Duration), {BackgroundTransparency = 0})

local player = game.Players.LocalPlayer

while wait() do
    if player:WaitForChild("Data").Teleporting.Value == true then
        if played == false then
            played = true
            Fade:Play()
        end
    end
end

Can someone help me?

Thank's for reading!

1 answer

Log in to vote
1
Answered by 3 years ago
Edited 3 years ago
local TweenService = game:GetService("TweenService")
local Duration = 5
local played = false

local Fade = TweenService:Create(script.Parent.Frame, TweenInfo.new(Duration), {BackgroundTransparency = 0}) -- you forgot to add a ".new" right after declaring TweenInfo

local player = game:GetService("Players").LocalPlayer

while wait() do -- not sure why you are spamming a tween every frame but ok
    if player:WaitForChild("Data").Teleporting.Value == true and played == false then -- you can combine both if statements into one
        played = true
        Fade:Play()
    end
end
Ad

Answer this question