Roblox Lua开发

问题描述 投票:0回答:1

我正在尝试制作roblox游戏,但是当我用lua编写脚本时,当我触摸门时什么也没发生:文本标签的入门gui]

game.Workspace.text:GetPropertyChangedSignal("Value"):Connect:(function())
    local text = script.Parent
    if game.Workspace.text.Value == 1 then
        script.Parent.Parent.Visible = true
        text.Text = "W"
        wait (.05)    
        text.Text = "We"
        wait (.05)   
        text.Text = "Wel"
        wait (.05)   
        text.Text = "Welc"
        wait (.05)   
        text.Text = "Welco"
        wait (.05)   
        text.Text = "Welcom"
        wait (.05)   
        text.Text = "Welcome"
        wait (.05)   
        text.Text = "Welcome !"
        wait (.05)
        wait (3)
        text.Text = "C"
        wait (.05)    
        text.Text = "Co"
        wait (.05)   
        text.Text = "Come"
        wait (.05)   
        text.Text = "Come I"
        wait (.05)   
        text.Text = "Come In "
        wait (.05)   
        text.Text = "Come In !"
        wait (.05)   
        wait (3)
        script.Parent.Parent.Visible = false       
    end 
end)

门的代码:

script.Parent.Touched:connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
    game.Workspace.text.Value = 1
    end
end)

感谢您的回答,我从未用lua编码过

lua roblox
1个回答
0
投票

如果怀疑脚本之一可能有问题,请检查“输出”窗格。在这种情况下,它说:

19:02:05.822 - Players.x.PlayerGui.ScreenGui.Frame.TextLabel.LocalScript:1: Expected '(', '{' or <string>, got ':'

这意味着在不应该存在一个冒号的地方。该行需要是:

game.Workspace.text:GetPropertyChangedSignal("Value"):Connect(function()
© www.soinside.com 2019 - 2024. All rights reserved.