local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Player = game.Players.LocalPlayer
local DialogEvent = ReplicatedStorage.Events.GuiEvents:FindFirstChild("DialogEvent")
local Frame = Player.PlayerGui:WaitForChild("Dialog").Frame
local function AnimateText(Dialog)
for i = 1, #Dialog, 1 do
Frame:WaitForChild("Dialog").Text = string.sub(Dialog, 1, i)
wait()
end
end
DialogEvent.OnClientEvent:Connect(function(Image, Name, Dialog)
Frame.Visible = true
Frame:WaitForChild("Image").Image = Image
Frame:WaitForChild("Name").Text = Name
AnimateText(Dialog)
end)
Can you send me the entire declaration of variable NpcImage and PlayerImage via text
To add, all you would have to do is take the Image’s .Image and set the NpcImage to it
I believe PlayerImage should be fine? I’m not sure until you test it since NpcImage is whats causing the error I think and so idk if its functional or not
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local DialogEvent = ReplicatedStorage.Events.GuiEvents:FindFirstChild("DialogEvent")
local ToggleDialogEvent = ReplicatedStorage.Events.ToggleEvents:FindFirstChild("ToggleDialogEvent")
local Npc = game.Workspace.Npcs:FindFirstChild("Crazy")
local NpcImage = "rbxassetid://6306615077"
local NpcName = Npc
local PlayerImage
local PlayerName
local function RandomPlayer()
local Players = game.Players:GetPlayers()
local RandomPlayer = math.random(1, #Players)
local ChosenPlayer = Players[RandomPlayer]
PlayerImage = game.Players:GetUserThumbnailAsync(ChosenPlayer.UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420)
PlayerName = ChosenPlayer.Name
end
local function Part1()
DialogEvent:FireAllClients(NpcImage, NpcName, "Hi, I'm Crazy, but that's just my name. I'm not actually crazy...")
wait(5)
RandomPlayer() DialogEvent:FireAllClients(PlayerImage, PlayerName, "What's that cave by the cabin?")
wait(5)
DialogEvent:FireAllClients(NpcImage, NpcName, "I don't know, but there is a sign that says to not enter.")
wait(5)
RandomPlayer() DialogEvent:FireAllClients(PlayerImage, PlayerName, "Oh okay, is that the cabin were going to be sleeping in?")
wait(5)
end
wait(10)
Part1()
Ok so it looks like it is infact playerimage messing up, npcimage is an assetid, instead you will need to send the player’s UserId to clients instead:
--WHEN SENDING PLAYER STUFF
DialogEvent:FireAllClients(nil, PlayerName, "What's that cave by the cabin?", PlayerId)
--NPC STAYS SAME
--DialogEvent:FireAllClients(NpcImage, NpcName, "Hi, I'm Crazy, but that's just my name. I'm not actually crazy...")
then in client:
DialogEvent.OnClientEvent:Connect(function(Image, Name, Dialog, PlayerId)
Frame.Visible = true
if Image then
Frame:WaitForChild("Image").Image = Image
else
Frame:WaitForChild("Image").Image=game.Players:GetUserThumbnailAsync(PlayerId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420)
end
Frame:WaitForChild("Name").Text = Name
AnimateText(Dialog)
end)
This should solve your issue, if it does please mark it as solution
Alright so how would I implement it though since the script I just sent is in ServerScriptService while the other script in the topic is in StarterGui as a local script.