Hello! My name is Frosty and recently I’ve been working on my game and I’m trying to add a burger system when you can make burgers. I’m stuck on a script that I need help on. The script is:
local Meat = game.Workspace.Oven.Meat
local SizzleSound = Meat.Parent.Sizzling
local plr = game.Workspace.StepOnButtons.OvenOpen1.PersonUsingOven.Value
script.Parent.MouseButton1Click:Connect(function()
if game.Workspace[plr].RawMeat then
Meat.Transparency = 1
wait(0.1)
SizzleSound.Script.Disabled = false
else
script.Parent.TextButton.Text = “Please hold the meat out”
script.Parent.Parent.Visible = false
wait(3)
script.Parent.TextButton.Text = “Cook Patty”
script.Parent.Parent.Visible = true
end
end)
My error I get is: [22:52:23.288 - is not a valid member of Workspace]
Basically PersonUsingOven is a string-value and I have a script set up for it to make the local players username go in there so it can access the players tools when they hold it out.
If I’m messing any other important details to help let me know.
Since the script that cooks the meat is on the server, and you assign the string’s value on the client, so it will return nil when you do game.Workspace[plr]. Maybe fire a RemoteEvent to the server to assign the value?
I’d change local plr = game.Workspace.StepOnButtons.OvenOpen1.PersonUsingOven.Value
to local plr = game.Workspace.StepOnButtons.OvenOpen1.PersonUsingOven
and then in if game.Workspace[plr].RawMeat then do if game.Workspace[plr.Value].RawMeat then
since by making it so plr is the .Value, the plr value would stay the same through all the execution, and by making it so plr is the object and what we check if the value of the object, we’re checking the value it has at that moment.