access a dictionary in roblox code example
Example: access a dictionary in roblox
-- 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