How would I get the location where the patty is cooked?

What is “Accused”?
If it’s a value, use Accused.Value
If it’s something you want the name of, use Accused.Name

1 Like

Not a value, accused should just be the player basically

Then it would be Accused.Name (Line 7 in cookburger)

Now that works, yet it doesnt make the PattyPlaceholders ( which are just parts to represent the pattys ) transparency = 0?

Are you getting the prints or just the “someone has placed a raw patty” one?

I put this into the script to see if it was actually getting the player, which it is, because its replying now in console with the extra

16:55:55.487 1 StarterGear - Server - CookBurger:11
16:55:55.487 2 PlayerGui - Server - CookBurger:11
16:55:55.487 3 HasRawPatty - Server - CookBurger:11
16:55:55.488 4 Backpack - Server - CookBurger:11

	local children = Accused:GetChildren()
	
	for i = 1, #children do
		print(i, children[i].Name)
	end

And this is the console.

16:57:46.316 CookPatty Fire Client 1 - Server - Grill:16
16:57:46.366 Someone has placed a Raw Patty. Accused : eggspIicit - Server - CookBurger:7

I changed the script to this to check if there was possibly an error and there was.

Script :

local Players = game:GetService("Players")
local player = Players.LocalPlayer
local RS = game:GetService("ReplicatedStorage")
local CookPatty2 = RS.Events:WaitForChild("CookPatty2")

CookPatty2.OnServerEvent:Connect(function(Accused)
	print("Someone has placed a Raw Patty. Accused : "..Accused.Name)

	if Accused.HasRawPatty.Value == true and game.Workspace.Grill.GrillTop.FirstSpot.Occupied.Value == false then
		print("Grill FirstSpot Patty")
		game.Workspace.Grill.GrillTop.FirstSpot.PattyPlaceholder.Transparency = 0
	else if Accused.HasRawPatty.Value == true and game.Workspace.Grill.GrillTop.SecondSpot.Occupied.Value == false then
			print("Grill SecondSpot Patty")
			game.Workspace.Grill.GrillTop.SecondSpot.PattyPlaceholder.Transparency = 0
		else
			print(Accused.Name.." has no spaces on the grill / has an error occured")
		end
	end
end)

Console :

17:01:14.408 CookPatty Fire Client 1 - Server - Grill:16
17:01:14.441 Someone has placed a Raw Patty. Accused : eggspIicit - Server - CookBurger:7
17:01:14.441 eggspIicit has no spaces on the grill / has an error occured - Server - CookBurger:16

Try to put an else after the elseif. In the else, print the HasRawPatty value, as well as the occupied value for spot 1 and 2

17:05:36.814 CookPatty Fire Client 1 - Server - Grill:16
17:05:36.847 Someone has placed a Raw Patty. Accused : eggspIicit - Server - CookBurger:7
17:05:36.847 eggspIicit has no spaces on the grill / has an error occured - Server - CookBurger:16
17:05:36.847 ServerScriptService.CookBurger:17: attempt to concatenate string with boolean - Server - CookBurger:17
17:05:36.847 Stack Begin - Studio
17:05:36.847 Script ‘ServerScriptService.CookBurger’, Line 17 - Studio - CookBurger:17
17:05:36.847 Stack End - Studio

Lot of stuff in console.

Here is what I changed the script to, not sure why it cant get the value for HasRawPatty?

local Players = game:GetService("Players")
local player = Players.LocalPlayer
local RS = game:GetService("ReplicatedStorage")
local CookPatty2 = RS.Events:WaitForChild("CookPatty2")

CookPatty2.OnServerEvent:Connect(function(Accused)
	print("Someone has placed a Raw Patty. Accused : "..Accused.Name)

	if Accused.HasRawPatty.Value == true and game.Workspace.Grill.GrillTop.FirstSpot.Occupied.Value == false then
		print("Grill FirstSpot Patty")
		game.Workspace.Grill.GrillTop.FirstSpot.PattyPlaceholder.Transparency = 0
	else if Accused.HasRawPatty.Value == true and game.Workspace.Grill.GrillTop.SecondSpot.Occupied.Value == false then
			print("Grill SecondSpot Patty")
			game.Workspace.Grill.GrillTop.SecondSpot.PattyPlaceholder.Transparency = 0
		else
			print(Accused.Name.." has no spaces on the grill / has an error occured")
			print("HasRawPatty -"..Accused.HasRawPatty.Value)
			print("Occupied First Spot Value -"..game.Workspace.Grill.GrillTop.FirstSpot.Occupied.Value)
			print("Occupied Second Spot Value -"..game.Workspace.Grill.GrillTop.SecondSpot.Occupied.Value)
		end
	end
end)

This is all I get back when I change it to tostring like it says in this post.

local Players = game:GetService("Players")
local player = Players.LocalPlayer
local RS = game:GetService("ReplicatedStorage")
local CookPatty2 = RS.Events:WaitForChild("CookPatty2")

CookPatty2.OnServerEvent:Connect(function(Accused)
	print("Someone has placed a Raw Patty. Accused : "..Accused.Name)

	if Accused.HasRawPatty.Value == true and game.Workspace.Grill.GrillTop.FirstSpot.Occupied.Value == false then
		print("Grill FirstSpot Patty")
		game.Workspace.Grill.GrillTop.FirstSpot.PattyPlaceholder.Transparency = 0
	else if Accused.HasRawPatty.Value == true and game.Workspace.Grill.GrillTop.SecondSpot.Occupied.Value == false then
			print("Grill SecondSpot Patty")
			game.Workspace.Grill.GrillTop.SecondSpot.PattyPlaceholder.Transparency = 0
		else
			print(Accused.Name.." has no spaces on the grill / has an error occured")
			local HasRawPatty = Accused.HasRawPatty
			local conversion = tostring(HasRawPatty)
			print("HasRawPatty -"..conversion)
			print("Occupied First Spot Value -"..game.Workspace.Grill.GrillTop.FirstSpot.Occupied.Value)
			print("Occupied Second Spot Value -"..game.Workspace.Grill.GrillTop.SecondSpot.Occupied.Value)
		end
	end
end)

17:15:49.109 HasRawPatty -HasRawPatty - Server - CookBurger:19
17:15:49.109 ServerScriptService.CookBurger:20: attempt to concatenate string with boolean - Server - CookBurger:20
17:15:49.109 Stack Begin - Studio
17:15:49.109 Script ‘ServerScriptService.CookBurger’, Line 20 - Studio - CookBurger:20
17:15:49.110 Stack End - Studio

edit , returns nil

Does the HasRawPatty show up in the explorer?
If so, is it created with a localscript and a serverscript is trying to reference it?

Created with a ServerScript.

Yeah, shows in explorer


same with Occupied

Try to put the occupied value in a tostring() for this

What happens if you try to print the value from a separate script?

It just returns with this, no errors.
Just the rest of the usual print and these 3 words.

First Spot Occupied - Server - CookBurger:21

Script I used below

		else
			print(Accused.Name.." has no spaces on the grill / has an error occured")
			
			local FirstSpot = game.Workspace.Grill.GrillTop.FirstSpot.Occupied
			local StringFirstSpot = tostring(FirstSpot)
			
			print("First Spot \t "..StringFirstSpot)
			
		end

I did this in a seperate server script

while wait(0.1) do
	local FirstSpot = game.Workspace.Grill.GrillTop.FirstSpot.Occupied
	local StringFirstSpot = tostring(FirstSpot)

	print("First Spot Current Value \t "..StringFirstSpot)
end

returns with this nonstop
image

You’re getting the name of it here, if you want the value use tostring(FirstSpot.Value)

What if you create a local server and check on the server side? To be honest if that’s not anything to do with it I’m not too sure

omg :man_facepalming:

a limit of words used to stop scams

It is false until i pick up the raw patty as expected
image

edit

added that into the script

local Players = game:GetService("Players")
local player = Players.LocalPlayer
local RS = game:GetService("ReplicatedStorage")
local CookPatty2 = RS.Events:WaitForChild("CookPatty2")

CookPatty2.OnServerEvent:Connect(function(Accused)
	print("Someone has placed a Raw Patty. Accused : "..Accused.Name)

	if Accused.HasRawPatty.Value == true and game.Workspace.Grill.GrillTop.FirstSpot.Occupied.Value == false then
		print("Grill FirstSpot Patty")
		game.Workspace.Grill.GrillTop.FirstSpot.PattyPlaceholder.Transparency = 0
	else if Accused.HasRawPatty.Value == true and game.Workspace.Grill.GrillTop.SecondSpot.Occupied.Value == false then
			print("Grill SecondSpot Patty")
			game.Workspace.Grill.GrillTop.SecondSpot.PattyPlaceholder.Transparency = 0
		else
			print(Accused.Name.." has no spaces on the grill / has an error occured")
			
			local FirstSpot = game.Workspace.Grill.GrillTop.FirstSpot.Occupied
			local StringFirstSpot = tostring(FirstSpot.Value)

			print("First Spot Current Value \t "..StringFirstSpot)
			
			local SecondSpot = game.Workspace.Grill.GrillTop.SecondSpot.Occupied
			local StringSecondSpot = tostring(SecondSpot.Value)

			print("Second Spot Current Value \t "..StringSecondSpot)
			
			local HasRawPatty = Accused.HasRawPatty
			local StringHasRawPatty = tostring(HasRawPatty.Value)
			
			print("HasRawPatty Current Value \t "..StringHasRawPatty)
		end
	end
end)

Here is console after I take a RawPatty and place it on the grill only once.

17:46:37.717 CookPatty Fire Client 1 - Server - Grill:16
17:46:37.767 Someone has placed a Raw Patty. Accused : eggspIicit - Server - CookBurger:7
17:46:37.767 eggspIicit has no spaces on the grill / has an error occured - Server - CookBurger:16
17:46:37.767 First Spot Current Value true - Server - CookBurger:21
17:46:37.768 Second Spot Current Value false - Server - CookBurger:26
17:46:37.768 HasRawPatty Current Value false - Server - CookBurger:31