I have a dialog system and I need it to show the player what the NPC is saying. I noticed in ROBLOX server version it yields on a variable which is called DialogGui. I have used the developer console to see what is nil and what is not. It shows up DialogGui nil. I have a module script in ReplicatedStorage, a LocalScript in StarterCharacterScripts and a ServerScript in a part.
-- Module Script --
local data = {}
data.warnScreen = game.ReplicatedStorage.WarnGui
data.backpackScreen = game.ReplicatedStorage.BackpackGui
data.dialogScreen = game.ReplicatedStorage.DialogGui
data.shopBlur = game.ReplicatedStorage.ShopBlur
data.tutorialScreen = game.ReplicatedStorage.TutorialGui
function data.openPageFunction(obj,pageTxt)
print("Animating Text!")
for i = 1,#pageTxt do
obj.Text = string.sub(pageTxt,1,i)
wait()
end
end
function data.closePageFunction(obj,pageText)
print("Animating Text")
for i = #pageText,1,-1 do
obj.Text = string.sub(pageText,-1,i)
wait()
end
end
function data.openWarning(parent,screen)
--[[
MainWarn Old Position: 0, 0,0.824, 0
MainWarn New Position: 0.004, 0,1.024, 0
KeyWarn Old Position: 0.423, 0,0.849, 0
KeyWarn New Position: 0.427, 0,1.048, 0
--]]
print("Warning Open!")
local newWarn = screen:Clone()
local mainWarn = newWarn:WaitForChild("MainWarn")
local keyWarn = newWarn:WaitForChild("KeyWarn")
newWarn.Parent = parent
mainWarn:TweenPosition(UDim2.new(0, 0,0.824, 0),"Out","Quad",1,true)
keyWarn:TweenPosition(UDim2.new(0.423, 0,0.849, 0),"Out","Quad",1,true)
end
function data.closeWarning(screen)
print("Warning Closed!")
local mainWarn = screen:WaitForChild("MainWarn")
local keyWarn = screen:WaitForChild("KeyWarn")
mainWarn:TweenPosition(UDim2.new(0.004, 0,1.024, 0),"Out","Quad",1,true)
keyWarn:TweenPosition(UDim2.new(0.427, 0,1.048, 0),"Out","Quad",1,true)
end
function data.changeProp(obj,walk,jump)
obj.WalkSpeed = walk
obj.JumpPower = jump
end
return data
-- Server Script --
local part = script.Parent
local module = require(game.ReplicatedStorage.GameModule)
local page1 = part["Pages_Config"]:WaitForChild("Page1")
local debounce = false
part.Touched:Connect(function(hit)
print("Part Touched!")
if debounce == false and hit then
debounce = true
print("Debounce to " .. tostring(debounce))
print("Declaring variables!")
local hum = hit.Parent:WaitForChild("Humanoid")
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local playerUI = player:FindFirstChild("PlayerGui")
if player then
print("Player is not nil!")
else
print("Player is nil!")
end
if playerUI then
print("PlayerGui is not nil!")
else
print("PlayerGui is nil!")
end
print("Changing humanoid properties!")
module.changeProp(hum,0,0)
print("Changed humanoid properties!")
print("Opening Warning Screen!")
module.openWarning(playerUI,module.warnScreen)
print("Opened Warning Screen!")
print("Declaring variables!")
local dialogGui = playerUI:WaitForChild(module.dialogScreen.Name)
if dialogGui then
print("Dialog Gui not nil!")
else
print("Dialog Gui is nil!")
end
local frame = dialogGui:WaitForChild("DialogMain")
local desc = frame:WaitForChild("Desc")
print("Declared variables!")
print("Opening page!")
module.openPageFunction(desc,page1.Value)
print("Opened page!")
end
wait(1)
if debounce == true then
debounce = false
end
end)
-- Local Script --
local uis = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local playerUI = player:FindFirstChild("PlayerGui")
local char = player.Character
local hum = char:WaitForChild("Humanoid")
local module = require(game.ReplicatedStorage.GameModule)
uis.InputBegan:Connect(function(key,gpe)
if key.KeyCode == Enum.KeyCode.X and not gpe and
playerUI:FindFirstChild("WarnGui") then
print("Start Dialog!")
local newDialog = module.dialogScreen:Clone()
newDialog.Parent = playerUI
local desc = newDialog:WaitForChild("DialogMain"):WaitForChild("Desc")
module.closeWarning(playerUI.WarnGui)
wait(1)
playerUI:WaitForChild("WarnGui"):Destroy()
end
end)
Filtering Enabled is true by the way

1 comment
It might work, however I don't want to give too much power to the client when the game comes out (I mean a lot of dialog systems).Plus I don't want any hackers changing what is inside the system(since the client can't access the server)