Hey. I am currently trying to make a script which makes a GUI open for one specific player chosen by the game. Looking at the script, it should be fine. But I dont know what makes the game get an error like that.

Script, function:

local function GetGUI(chosenp)
	print(chosenp) --prints the name without any other letters
	game.ReplicatedStorage.Dialogg8:FireClient(game.Players:FindFirstChild(chosenp))
end

Script, receives player:
game.ReplicatedStorage.Dialogg7.OnServerEvent:Connect(GetGUI)

LocalScript, sends the player:

local function Choosen(chosen)
	game.Players.LocalPlayer.PlayerGui.Dialog.Frame.Text.Text = chosen
	wait(0.1)
	game.Players.LocalPlayer.PlayerGui.Dialog.Frame.Text.Text = chosen .. "."
	wait(2)
	game.Players.LocalPlayer.PlayerGui.Dialog.Frame.Text.Text = chosen
	wait(0.1)
	game.Players.LocalPlayer.PlayerGui.Dialog.Frame.Text.Text = chosen .. "."
	wait(0.1)
	game.Players.LocalPlayer.PlayerGui.Dialog.Frame.Text.Text = chosen .. ". "
	wait(0.1)
	game.Players.LocalPlayer.PlayerGui.Dialog.Frame.Text.Text = chosen .. ". T"
	wait(0.1)
	game.Players.LocalPlayer.PlayerGui.Dialog.Frame.Text.Text = chosen .. ". Tr"
	wait(0.1)
	game.Players.LocalPlayer.PlayerGui.Dialog.Frame.Text.Text = chosen .. ". Tru"
	wait(0.1)
	game.Players.LocalPlayer.PlayerGui.Dialog.Frame.Text.Text = chosen .. ". Trut"
	wait(0.1)
	game.Players.LocalPlayer.PlayerGui.Dialog.Frame.Text.Text = chosen .. ". Truth"
	wait(0.1)
	game.Players.LocalPlayer.PlayerGui.Dialog.Frame.Text.Text = chosen .. ". Truth "
	wait(0.1)
	game.Players.LocalPlayer.PlayerGui.Dialog.Frame.Text.Text = chosen .. ". Truth o"
	wait(0.1)
	game.Players.LocalPlayer.PlayerGui.Dialog.Frame.Text.Text = chosen .. ". Truth or"
	wait(0.1)
	game.Players.LocalPlayer.PlayerGui.Dialog.Frame.Text.Text = chosen .. ". Truth or "
	wait(0.1)
	game.Players.LocalPlayer.PlayerGui.Dialog.Frame.Text.Text = chosen .. ". Truth or D"
	wait(0.1)
	game.Players.LocalPlayer.PlayerGui.Dialog.Frame.Text.Text = chosen .. ". Truth or Da"
	wait(0.1)
	game.Players.LocalPlayer.PlayerGui.Dialog.Frame.Text.Text = chosen .. ". Truth or Dar"
	wait(0.1)
	game.Players.LocalPlayer.PlayerGui.Dialog.Frame.Text.Text = chosen .. ". Truth or Dare"
	wait(0.1)
	game.Players.LocalPlayer.PlayerGui.Dialog.Frame.Text.Text = chosen .. ". Truth or Dare?"
	game.ReplicatedStorage.Dialogg7:FireServer(chosen)
end

game.ReplicatedStorage.Dialogg6.OnClientEvent:Connect(Choosen)

I did it like that with every other function, but only this one doesnt work.

1 comment

1

.OnServerEvent already returns a player object, so you don't need to find the player. Just do :FireClient(chosenp).