📜  在 roblox 中访问字典 - 无论代码示例

📅  最后修改于: 2022-03-11 14:57:56.658000             🧑  作者: Mango

代码示例1
-- This Script is inside a Part in the Workspace
-- Everytime A Player Runs over that Part, this Function will run

-- Access The Script where Our Dictonary is
local speechMod = require(game.ServerScriptService.speechModScript)

-- Accessing the Part in our workspace
local trigger = script.Parent

-- This is a Debounce, so you dont get strange Errors
local db = true
local nextLine = 0
local questNum = 1

-- Our Function that Triggers when the Part gets Touched by an Player
trigger.Touched:Connect(function(hit)

    local char = hit.Parent
    local hum = char:FindFirstChild("Humanoid")
            if hum and db then
                db = false
                nextLine = nextLine + 1
                local quest = "quest"..tostring(questNum)
                local line = "line"..tostring(nextLine)
                print(speechMod.speech[quest][line])
                wait(.5)
                db = true
            end
        end)
        
-- Look at my coding answers in Grepper, then you will see the other script with
    the Dictonary
-- LUA Scripting Language