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