GUI Dialog Replication Problem?

I’ve currently been working on fixing my GUI’s and a dialog system to notice a slight problem.
Whenever a player touches a “Dialog Brick”, it should cause a Dialog gui to only appear on their screen and nobody else. The Dialog Bricks have a module with their respected dialogs and modules for setting the look and appearence.

The GUI for some reason appears on everybody’s screen. There are no RemoteEvents/RemoteFunctions whatsoever. I’m also doing it on a Local Script which I presume should work without any problems and should only tween on the client side?

The script is located in the GUI itself:

for _,Dialogs in pairs(CS:GetTagged("DialogPoints")) do
	Dialogs.Touched:Connect(function(Part)
		if Part.Parent:FindFirstChild("Humanoid") then
			if not DEB then
				DEB = true
				local HRP = Part.Parent:FindFirstChild("HumanoidRootPart")
				local TSEQ = require(Dialogs.TextSequence)
				if Dialogs:FindFirstChild("IsATutorial") then
					HRP.CFrame = Dialogs.CFrame
					HRP.Velocity = Vector3.new(0,0,0)
					Part.Parent:FindFirstChild("Humanoid").WalkSpeed = 0
				end
				ShowFrame()
				Dialogs:Destroy()
				StartDialog(TSEQ)
				HideFrame()
				Part.Parent:FindFirstChild("Humanoid").WalkSpeed = 16
				DEB = false
				HRP.Anchored = false
			end
		end
	end)
end

TSEQ is the module from the Dialog parts, it contains all the dialogs needed to be played.

local function StartDialog(TableMsg)
	for i = 1, #TableMsg, 1 do
		local TextObj = TextModule:New(TF, TableMsg[i].Text, {Font = "SourceSansLight"})
		AssignCubeType(TableMsg[i].CubeType)
		AssignWantedExpression(TableMsg[i].Expression)
		TextObj:Animate(true)
		CBTweenIn:Play()
		wait(CBTweenIn.TweenInfo.Time)
		HPressed = false
		repeat wait() until HPressed
		CBTweenOut:Play()
		wait(CBTweenOut.TweenInfo.Time)
		TextObj:Hide()
	end
end

The StartDialog is where it starts the dialog and changes the dialog messages.

Any reason to why this is happening?

are you running this in studio? if so try to check on the live servers, if you need another user Im free right now.

1 Like

Running this in studio works fine for 1 player, running this with 2 players or more makes it replicate the dialog to all players.

is it running on a local server with multiple clients though?

EDIT: just re-read what you had said, try to run this from the website since local servers run differently to live servers from what I can remember.

I’ve tested the game online with this 2 and more players, it does the exact same problem of replicating to all players.

maybe seperate the “StartDialog” function and take it out of replicated storage? not entirely sure if this would change anything but best to cover all bases.

The StartDialog function is in the same script with the collectionservice thing.

so the first script is a local script?

Hoan, it’s opening the gui when the part is touched by a Model with a humanoid and humanoidRootPart, but you never added a check to see if that model is the player’s character

1 Like

So would I do:

for _,Dialogs in pairs(CS:GetTagged("DialogPoints")) do
	Dialogs.Touched:Connect(function(Part)
		if Part.Parent:FindFirstChild("Humanoid") then
			if game.Players:GetPlayerFromCharacter(Part.Parent) then
				if not DEB then
					DEB = true
					local HRP = Part.Parent:FindFirstChild("HumanoidRootPart")
					local TSEQ = require(Dialogs.TextSequence)
					if Dialogs:FindFirstChild("IsATutorial") then
						HRP.CFrame = Dialogs.CFrame
						HRP.Velocity = Vector3.new(0,0,0)
						Part.Parent:FindFirstChild("Humanoid").WalkSpeed = 0
					end
					ShowFrame()
					Dialogs:Destroy()
					StartDialog(TSEQ)
					HideFrame()
					Part.Parent:FindFirstChild("Humanoid").WalkSpeed = 16
					DEB = false
					HRP.Anchored = false
				end
			end
		end
	end)
end

?

that’ll just check if the model that touched is a player, not the LocalPlayer, you should do

if game.Players:GetPlayerFromCharacter(Part.Parent) == game.Players.LocalPlayer then
1 Like

I’ve never knew about this, thanks!