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

I am working on a grill system with four spots. (Each pink part)

Some reason the RemoveEvent doesnt have the pattys appear on the grill top.

There is only one error which is

16:35:40.318 ServerScriptService.CookBurger:7: attempt to concatenate string with Instance - Server - CookBurger:7
16:35:40.319 Stack Begin - Studio
16:35:40.319 Script ‘ServerScriptService.CookBurger’, Line 7 - Studio - CookBurger:7
16:35:40.319 Stack End - Studio

I have done so much on this I actually have confused myself more than anything and I need some help.

FORMATTED : Name(TypeOfScript, Parent)

BurgerCreator (ServerScript, ServerScriptService)

local Players = game:GetService("Players")
local player = Players.LocalPlayer


Players.PlayerAdded:Connect(function(player)
	--// create boolvalue
	local HasRawPatty = Instance.new("BoolValue")
	HasRawPatty.Name = "HasRawPatty"
	HasRawPatty.Parent = player
	HasRawPatty.Value = false
	print("Player given "..HasRawPatty.Name.." BoolValue")
end)

ChangeValueRawPatty (ServerScript, ProximityPrompt)

local Players = game:GetService("Players")
local RS = game:GetService("ReplicatedStorage")
local ChangeRawPatty = RS.Events:WaitForChild("ChangeRawPatty")

script.Parent.Triggered:Connect(function(player)
	ChangeRawPatty:FireClient(player)
end)

ClientSidePatty (LocalScript ,StarterPlayerScripts)

local Players = game:GetService("Players")
local player = Players.LocalPlayer

local RS = game:GetService("ReplicatedStorage")
local ChangeRawPatty = RS.Events:WaitForChild("ChangeRawPatty")
local CoreGui = game:GetService("StarterGui")
local pattyCheck = false

ChangeRawPatty.OnClientEvent:Connect(function()
	if pattyCheck == false then
		player.HasRawPatty.Value = true
		pattyCheck = true
		CoreGui:SetCore("SendNotification", {
			Title = "Success!";
			Text = "You now have a patty in your inventory!";
			Duration = 5;
		})
		
		game.Workspace.Grill.GrillTop.Attachment.ProximityPrompt.Enabled = true
		
	elseif pattyCheck then
		CoreGui:SetCore("SendNotification", {
			Title = "Failed";
			Text = "You already have a patty in your inventory!";
			Duration = 5;
		})
	end
end)

Grill (ServerScript ,ProximityPrompt)

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

local grill = script.Parent.Parent.Parent
local Spot1 = grill.FirstSpot
local Spot2 = grill.SecondSpot
local Spot3 = grill.ThirdSpot
local Spot4 = grill.FourthSpot

script.Parent.Triggered:Connect(function(player)
	if Spot1.Occupied.Value == false then
		Spot1.Occupied.Value = true
		CookPatty1:FireClient(player, player.Name)
		print("CookPatty Fire Client 1")
	elseif Spot2.Occupied.Value == false then
		Spot2.Occupied.Value = true
		CookPatty1:FireClient(player, player.Name)
		print("CookPatty Fire Client 2")
	elseif Spot3.Occupied.Value == false then
		Spot3.Occupied.Value = true
		CookPatty1:FireClient(player, player.Name)
		print("CookPatty Fire Client 3")
	elseif Spot4.Occupied.Value == false then
		Spot4.Occupied.Value = true
		CookPatty1:FireClient(player, player.Name)
		print("CookPatty Fire Client 4")
	elseif Spot1.Occupied.Value == true and Spot2.Occupied.Value == true and Spot3.Occupied.Value == true and Spot4.Occupied.Value == true then
		warn("All grill spaces occupied. Try again later")
	end
end)

At this point I tried to maybe send it from server to client to server but that didnt end up well and now I’m experiencing errors. The reason I go to client is to check if the player has the value for having the burger in their inventory == true.

BurgerClient (LocalScript ,StarterGui)

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

CookPatty1.OnClientEvent:Connect(function(Accused)
	CookPatty2:FireServer(player, player.Name)
end)

CookBurger (ServerScript ,ServerScriptService)

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)

	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
		end
	end
end)

Video of what happens shown below or click here

Any help ? (this is alot of reading sorry)

2 Likes

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