"Workspace.RedPedastal.Script:17: attempt to index function with 'Transparency'" 在 Roblox 脚本上

"Workspace.RedPedastal.Script:17: attempt to index function with 'Transparency'" on Roblox script

我正在制作一个 roblox 脚本,它将传送玩家并制作“光束”动画,但是当我通过在 tele pad 上行走来激活脚本时,出现此错误

Workspace.RedPedastal.Script:17: attempt to index function with 'Transparency'

代码:

local Teleport = "BeachHill"
local Beam = workspace.Beam

function Beam() #Just here incase of need
    for i = 0, 100, 1 do
        Beam.Transparency = 1 - i/100
        Beam.Size = Vector3.new(2048, 1.8 + i/10, 1.8 + i/10)
        print(Beam.Transparency, Beam.Size)
    end
end
    
function Touch (hit)
    if script.Parent.Locked == false and script.Parent.Parent : FindFirstChild(Teleport).Locked == false then script.Parent.Locked = true script.Parent.Parent:FindFirstChild(Teleport).Locked=true
        local Pos = script.Parent.Parent:FindFirstChild(Teleport)
        hit.parent:moveTo(Pos.Position)
        for i = 0, 100, 1 do
            Beam.Transparency = Beam.Transparency - 0.01 #<- Error
            Beam.Size = Vector3.new(2048, 1.8 + i/10, 1.8 + i/10)
            print(Beam.Transparency, Beam.Size)
        end     
        wait(1)
        script.Parent.Locked = false
        script.Parent.Parent:FindFirstChild(Teleport).Locked = false
        end
           end
    script.Parent.Touched:connect(Touch)

Lua 中的函数和变量位于同一个命名空间中,因此您不能在同一个地方同时拥有一个名为 Beam 的函数和变量。