Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why the error? I cant see whats wrong please help, and tweak so theres no error

The error Workspace.Part.Script:15: Ambiguous syntax: this looks like an argument list for a function call, but could also be a start of new statement Im trying to make a frame visible on touch with a script

The script in the Part:

local part = script.Parent
part.Touched:Connect(
    function(hit)
        hit.Parent.HumanoidRootPart.Anchored = true
        local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
        if plr then
            plr:FindFirstChild("PlayerGui").Quest1.Frame.Visible = true
                plr:FindFirstChild("PlayerGui").Quest1.Frame.Visible = true
                wait(0.1)
                plr:FindFirstChild("PlayerGui").Quest1.Frame:WaitForChild("TextLabel").Visible = true
                wait(0.1)
                plr:FindFirstChild("PlayerGui").Quest1.Frame.TextLabel.Text =
                    ("Hey, can you find my teddy bear? I lost it *is sad*")
			                wait(3)
			("PlayerGui").Quest1.Frame.Where is it?.Visible = true
			("PlayerGui").Quest1.Frame.Goodbye!.Visible = true
			wait(0.1)
			("PlayerGui").Quest1.Frame.Where is it?.Text = ("Where is it?")
			("PlayerGui").Quest1.Frame.Goodbye!.Text = ("Goodbye!")
            end
        end
)
part.TouchEnded:Connect(
    function(hit)
        hit.Parent.HumanoidRootPart.Anchored = true
        local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
        plr:FindFirstChild("PlayerGui").Quest1.Frame.Visible = false
    end
)

1 answer

Hey! Try using [""] and plr:FindFirstChild!

local part = script.Parent
part.Touched:Connect(
    function(hit)
        hit.Parent.HumanoidRootPart.Anchored = true
        local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
        if plr then
            plr.PlayerGui.Quest1.Frame.Visible = true
                plr.PlayerGui.Quest1.Frame.Visible = true
                wait(0.1)
                plr.PlayerGui.Quest1.Frame:WaitForChild("TextLabel").Visible = true
                wait(0.1)
                plr.PlayerGui.Quest1.Frame.TextLabel.Text =
                    ("Hey, can you find my teddy bear? I lost it *is sad*")
                            wait(3)
           plr.PlayerGui.Quest1.Frame.["Where is it?"].Visible = true
            plr.PlayerGui.Quest1.Frame.["Goodbye!"].Visible = true
            wait(0.1)
           plr.PlayerGui.Quest1.Frame.["Where is it?"].Text = ("Where is it?")
            plr.PlayerGui.Quest1.Frame.["Goodbye!"].Text = ("Goodbye!")
            end
        end
)
part.TouchEnded:Connect(
    function(hit)
        hit.Parent.HumanoidRootPart.Anchored = true
        local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
        plr:FindFirstChild("PlayerGui").Quest1.Frame.Visible = false
    end
)

This discussion is preserved as it was. New answers, comments, and votes are closed.