Need help with player gui script in a proximity prompt

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? I want to find a fix for the problem, where a player triggers a proximity prompt and it shows dialogue only for the player who triggered it, but not for the entire server.

  2. What is the issue? Player who triggered the proximity prompt is given a GUI and stuff that happens in the script, but other players in the server doesn’t.

  3. What solutions have you tried so far? Making remote-events but they didn’t help at all

So I will tell my script as close as it is.

local Sound = script.Parent.Ring
Sound:Play()
local TS = game:GetService("TweenService")
script.Parent.ok.ProximityPrompt.Triggered:Connect(function(trigger)
	script.Parent.Pick:Play() 
	workspace.Phone.BillboardGui:Destroy()
	trigger.Character.Humanoid.WalkSpeed = 0 
	for _, players in pairs(game:GetService("Players"):GetPlayers()) do
		players.PlayerGui.TextGui.Box.dName.Text = trigger.DisplayName
		players.PlayerGui.TextGui.Enabled = true
		local TextLabel = players.PlayerGui.TextGui.Box.dText
		local function typewrite(object, text, length)
			for i = 1,#text,1 do
				script.Parent.SFX:Play()
				object.Text = string.sub(text, 1, i)
				wait(length)
			end
		end
		local function name(nameText)
			players.PlayerGui.TextGui.Box.dName.Text = nameText
		end
		players.PlayerGui.TextGui.Box.dName.Text = trigger.DisplayName
		local l1 = 0.07

		typewrite(TextLabel, "... Hello?", l1)

		-- here is BIG dialogue but its not important at all

		typewrite(TextLabel, "Thanks.", l1)
		wait(1)
		script.Parent.SFX2:Play()
		trigger.Character.Humanoid.WalkSpeed = 9
		workspace.Phone.Screen.Color = Color3.fromRGB(0,0,0)
		players.PlayerGui.TextGui.Enabled = false
		wait(2)
		local t123 = TS:Create(players.PlayerGui.Text2Gui.Box.dText, TweenInfo.new(1.2), {TextTransparency = 0.15})
		t123:Play()
		t123.Completed:Wait()
		wait(2.5)
		local t124 = TS:Create(players.PlayerGui.Text2Gui.Box.dText, TweenInfo.new(3), {TextTransparency = 1})
		t124:Play()
		t124.Completed:Wait()
		players.PlayerGui.Text2Gui.Objective1.Text = "blah blah objective"
		players.PlayerGui.Text2Gui.ObjectiveGoal.Text = "0/1"
		workspace.PaperPrompt.ProximityPrompt.Enabled = true
		local t125 = TS:Create(players.PlayerGui.Text2Gui.Objective1, TweenInfo.new(1), {TextTransparency = 0})
		local t126 = TS:Create(players.PlayerGui.Text2Gui.ObjectiveGoal, TweenInfo.new(1), {TextTransparency = 0})
		local t127 = TS:Create(players.PlayerGui.Text2Gui.ObjectiveText, TweenInfo.new(1), {TextTransparency = 0})
		t127:Play()
		wait(0.3)
		t125:Play()
		wait(0.3)
		t126:Play()
		t126.Completed:Wait()
		script.Disabled = true
	end
end)

The problem is - script plays only for the triggered person and completely ignores the “GetPlayers” function. BUT after the script is done for triggered player, it starts to work for the second player, from my experience (as my friend picked up the call first) my script got stuck at the line where it says “typewrite(TextLabel, "Thanks.", l1)” (aka. end of dialogue) and it never ends for other players (for triggered player it does).

Soo if anyone got a fix please let me know!

1 Like