Part not loading in

This is my first post tell me if I have done anything wrong!! :smiling_face:
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 :frowning: Like, when I go to it, the dialog works, but not the code it should run after the player picks a choice.

Useful Images

Pls promise me you won’t leak my game or whatever


Error I get everytime
Screenshot 2024-08-22 191816
The little part viewed in studio

NPC viewed in playtest

Distance to spawn (spawn is in black box)
Screenshot 2024-08-22 192433
Little Part’s relation to the script (lil part is named chat)

local chatCube = script.Parent

How I defined Chat

Solutions I have tried so far:

  • Making part bigger
  • Checking spelling in script

That’s it tysm for helping me

2 Likes

Parent the Dialog to the Rig’s head instead.

2 Likes

Ok I’ll try that, thanks for reply! Will tell you soon (real soon) if it worked

2 Likes

Nope, still not working. I adds another bug, so I’ll stick with what it was.

2 Likes

Can I see the script? I need to see it to check for errors

And you always parent dialog to the Head I wouldn’t use a part

2 Likes

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 :frowning:

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)
2 Likes

Do you have StreamingEnabled set to true? It can cause object to not load in when the character isn’t near it.

2 Likes

No, never heard of that… Will try that

1 Like

Also where can I find it?? I am not seeing it

2 Likes

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

2 Likes

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)
2 Likes

Also


Position of what we need in the workspace

Screenshot 2024-08-23 090640
The StartPlayer containing the LocalScript

2 Likes

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)
2 Likes

Wow thanks, did not see that! Could have given me trouble!

No, that is the only part named “Chat” in all the experience, including SubPlaces. There is a folder named “ChatKick”.

I switched from StarterCharacterScripts to StarterPlayerScripts

Tried this, still not working.

1 Like

Can you explain again what the code is supposed to do?

1 Like

It’s supposed to fire a remote event when the dialogue is finished with some arguments that are different depending on the chosen choice

1 Like

I fixed it! The solution: Using a :WaitForChild()

1 Like

I fixed it

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.