Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago
Edited 4 years ago

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

0
try to use waitforchild when getting shopkeeper1 karesiku 72 — 4y
0
worked! thank you! :) Kataclysmix 23 — 4y
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 JesseSong 3916 — 4y

1 answer

Log in to vote
0
Answered by
JesseSong 3916 Moderation Voter Community Moderator
4 years ago
Edited 4 years ago
local dialog = workspace:WaitForChild( "Shopkeeper1" ).Head.Dialog

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

dialog.DialogChoiceSelected:Connect(shopHandler)
Ad

Answer this question