Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Shopkeeper1 is not a valid member of Workspace? [ANSWERED]

Script Type: Local

Location: ReplicatedFirst

local dialog = workspace.Shopkeeper1.Head.Dialog

local function shopHandler(plr, choice)
	print(plr)
end

dialog.DialogChoiceSelected:Connect(shopHandler)

There is indeed an object named Shopkeeper1 in the workspace (i took a screenshot of the workspace, so here is the screenshot: https://imgur.com/a/mI18yfP )

The object was not created by the Instance.new function.

Any help is greatly appreciated

3 comments

0

try to use waitforchild when getting shopkeeper1

0

worked! thank you! :)

0

The reason WaitForChild worked was because  the server waited for a child be added in in this case would be shopkeeper1. Sometimes it can cause a lag or an issue

1 answer

✓ Accepted answer
local dialog = workspace:WaitForChild( "Shopkeeper1" ).Head.Dialog

local function shopHandler(plr, choice)
    print(plr)
end

dialog.DialogChoiceSelected:Connect(shopHandler)

This discussion is preserved as it was. New answers, comments, and votes are closed.