This is my first post tell me if I have done anything wrong!!
Also, is this category ok? Idk if I should pick Building or Scripting Support
So, I have an NPC that speaks to the player, and I made an R6 rig as a decoration and the actual speech and code in a transparent part right in front of the NPC. However, the part is not loading Like, when I go to it, the dialog works, but not the code it should run after the player picks a choice.
It’s because the rig head is close to the tree and if I do so the chat gets cut in the middle by the tree trunk and that lessens the already low quality
Script:
local chatCube = script.Parent
local PeasantRemoteEvent = chatCube.Parent.PeasantRemoteEvent
local dialog = chatCube.Dialog
local dChoice1 = dialog.BadEnding
local dChoice2 = dialog.WorseEnding
local dChoice3 = dialog.WorstEnding
chatCube.Transparency = 1
chatCube.CanCollide = false
dialog.GoodbyeDialog = "uhhh I gtg ok?"
dialog.InitialPrompt = "Hi there pal! Me and Noob just chilling here. Also, can you lend me some bobux? I'll give them back to you!"
dChoice1.UserDialog = "Alright have some. Don't forget to give them back!"
dChoice1.ResponseDialog = "hehe"
dChoice2.UserDialog = "Oh I'm sorry, i have 0 bobux"
dChoice2.ResponseDialog = "This is it mate, the life of us poor peasants."
dChoice3.UserDialog = "NOPE LOL"
dChoice3.ResponseDialog = "selfish >:("
PeasantRemoteEvent.OnServerEvent:Connect(function(player, plr, msg, bdg)
_G.kick_and_award(plr, msg, bdg)
end)
StreamingEnabled is not the issue, so don’t worry about that
Run the game and look for the part in the workspace and see if the part is actually in the game. It could be something simple like the part is not anchored (chatCube.Anchored = true)
The error in the output suggests that there is simply something out of place so check and see if everything is where it is supposed to. Send screenshots of the whole system (the explorer tab) so I can see what is wrong
The part is anchored, I checked that 100 times before.
Also, I used script.Parent which should make the only relevant part of the explorer the Chat and it’s child Script. Also, sometimes when I use “Play Here” to directly playtest the NPC, I spawn next to him and the part loads perfectly.
ALSO WAIT! I’m such a dummy. This whole time the error was in the LocalScript not the script I showed you all this time. Here is the LocalScript code:
local PeasantRemoteEvent = workspace.KickMessages.PeasantBaconKick.PeasantRemoteEvent
local dialog = PeasantRemoteEvent.Parent.Chat.Dialog
local message1 = "Peasant Bacon Bad Ending: u got scammed"
local message2 = "Peasant Bacon Worse Ending: no bobux for him nor u"
local message3 = "Peasant Bacon Worst Ending: no bobux? selfish :("
local function go(plr, msg, bdg)
PeasantRemoteEvent:FireServer(plr, msg, bdg)
end
dialog.DialogChoiceSelected:connect(function(Player, Choice)
if Choice.Name == "BadEnding" then
go(Player, message1, 2968599966575418)
elseif Choice.Name == "WorseEnding" then
go(Player, message2, 2236675367319420)
elseif Choice.Name == "WorstEnding" then
go(Player, message3, 646967048418659)
end
end)
Check the spelling of LocalPeasantDIalogScript because there is an uppercase “I” in there instead of a lower case
what is in the other folders? Is there a part named chat as well?
go ahead and try this and read the note at the top of the script
--[[ LocalScript called "LocalPeasantDialogScript" In StarterPlayerScripts
]]
local Workspace = game:GetService("Workspace")
local PeasantRemoteEvent = Workspace.KickMessages.PeasantBaconKick.PeasantRemoteEvent
local dialog = PeasantRemoteEvent.Parent.Chat.Dialog
local message1 = "Peasant Bacon Bad Ending: u got scammed"
local message2 = "Peasant Bacon Worse Ending: no bobux for him nor u"
local message3 = "Peasant Bacon Worst Ending: no bobux? selfish :("
local function go(plr, msg, bdg)
PeasantRemoteEvent:FireServer(plr, msg, bdg)
end
dialog.DialogChoiceSelected:connect(function(Player, Choice)
if Choice.Name == "BadEnding" then
go(Player, message1, 2968599966575418)
elseif Choice.Name == "WorseEnding" then
go(Player, message2, 2236675367319420)
elseif Choice.Name == "WorstEnding" then
go(Player, message3, 646967048418659)
end
end)