Because my game is FilteringEnabled
, I have to make a custom dialog once the default one does not fit my requirements. And because I want to transmit the dialog boxes to all the players, I decided to make some RemoteEvents
to pass the barrier.
It does not work. Or even worse, it does not even run in 3 of 4 environments I tested, and the one that runned went error. What's wrong?
local c = script.Parent.Chair.Seat local npc = script.Parent["Stevyl Karol"].Head local plr = script.Talker c.Changed:connect(function() if c.Occupant == nil then local player = game.Players:FindFirstChild(plr.Value) if player then print(plr.Value, 'jumped. Yay!') plr.Value = "" for i,v in pairs(game.Players:GetChildren()) do script.RemoteEvents.RemakeDialogGui:FireClient(v, npc) end else print(plr.Value, 'is gone') plr.Value = "" end else plr.Value = c.Occupant.Parent.Name print(plr.Value, 'sit down') for i,v in pairs(game.Players:GetChildren()) do script.RemoteEvents.EngageDialog:FireClient(v) end end end)
script.Parent.RemakeDialogGui.OnClientEvent:connect(function(p,v) p.PlayerGui["Dialog "..script.Parent.Parent.Parent.Parent.Name]:Destroy() print("Dialog box sucessfully destroyed for", p.Name) p.PlayerGui["DialogEngage "..script.Parent.Parent.Name]:Destroy() print("DialogEngage box sucessfully destroyed for", p.Name) local newDialog = game.ReplicatedStorage["Dialog "..script.Parent.Parent.Name]:Clone() print("Dialog cloned") local newEngager = game.ReplicatedStorage["DialogEngage "..script.Parent.Parent.Name]:Clone() print("DialogEngage cloned") newDialog.Parent = p.PlayerGui print("Dialog parented to", p.Name) newEngager.Parent = p.PlayerGui print("DialogEngage parented to",p.Name) newDialog.Adornee = v print("Dialog adornee for", p.Name) newEngager.Adornee = v print("DialogEngage adornee for", p.Name) end) script.Parent.EngageDialog.OnClientEvent:connect(function(v) local dialog = v.PlayerGui["Dialog "..script.Parent.Parent.Parent.Parent.Name] local dialogEngage = v.PlayerGui["DialogEngage "..script.Parent.Parent.Parent.Parent.Name] local prompt = script.Parent.Parent.Dialog.InitialPrompt dialog.Enabled = true print(dialog.Enabled) dialogEngage.Enabled = false print(dialogEngage.Enabled) for i = 1, string.len(prompt.Value) do dialog.Frame.TextLabel.Text = string.sub(prompt.Value, 1, i) wait(0.05) end end)
On sitting down:
Player sit down 20:59:32.809 - Workspace.Melt Metal Factory.Base.DialogCoreScript.RemoteEv:21: attempt to index local 'v' (a nil value) 20:59:32.810 - Stack Begin 20:59:32.811 - Script 'Workspace.Melt Metal Factory.Base.DialogCoreScript.RemoteEv', Line 21 20:59:32.812 - Stack End
On jumping:
Player jumped. Yay! 20:59:46.183 - PlayerGui is not a valid member of Part 20:59:46.183 - Script 'Workspace.Melt Metal Factory.Base.DialogCoreScript.RemoteEv', Line 2 20:59:46.184 - Stack End
On sitting down:
Player sit down
On jumping:
Player jumped. Yay!
no output
On sitting down:
Player sit down
On jumping:
Player jumped. Yay!
no output
On sitting down:
Player sit down
On jumping:
Player jumped. Yay!
NOTE: If you need more info i'll provide it as soon as possible