Scrixptz
(Scrixptz)
January 14, 2021, 12:43am
#1
Hello, I’m current scripting a restaurant system. But when I want to add bread to the plate it just names the item I’m holding. Instead of switching out the Plate for Plate w/ Bread.
Screenshots:
robloxapp-20210114-1140257.wmv (1.3 MB)
If you are able to help, It would be appreciated!
Kind regards, Scrixptz.
FIame7122
(FIame7122)
January 14, 2021, 12:47am
#2
Is their more code than just this? The code that you provided only renames the tool.
Scrixptz
(Scrixptz)
January 14, 2021, 12:48am
#3
The only other code is the Plate giver.
What is the parent of the script? If the bread is getting renamed that means the bread is the part touching the plate not the other way around.
Scrixptz
(Scrixptz)
January 14, 2021, 12:50am
#5
I’m not sure I understand? The bread is meant to touch the plate first, the plate shouldn’t touch the bread?
Scrixptz
(Scrixptz)
January 14, 2021, 12:51am
#6
There is also no parent of the script, It is just a present script.
FIame7122
(FIame7122)
January 14, 2021, 12:52am
#7
function tch(h)
if (h.Parent.Name == "Plate") then
wait(3)
-- Give the player a tool with a plate and bread
end
Scrixptz
(Scrixptz)
January 14, 2021, 12:53am
#8
I have created a tool with the bread ontop of the bread. I’m not sure what script to put there to destroy the plate, and give the plate with bread.
FIame7122
(FIame7122)
January 14, 2021, 12:54am
#9
Just give the player another tool once the plate touches it and destroy the current tool.
Scrixptz
(Scrixptz)
January 14, 2021, 12:55am
#10
Sorry, I’m very new to scripting and don’t know how to destroy the plate and hand a new tool.
FIame7122
(FIame7122)
January 14, 2021, 12:58am
#12
function Tch(hit)
if hit.Parent.Name == "Plate" then
hit.Parent:Destroy() -- Destroy the Plate
local clone = -- Clone the Bread (make sure it is a tool)
clone.Parent = game.Players:GetPlayerFromCharacter(hit.Parent.Parent).Backpack
end
end
script.Parent.Touched:Connect(function(Tch)
Scrixptz
(Scrixptz)
January 14, 2021, 1:04am
#13
I have tried it but now the script doesn’t detect the plate, and nothing happens within the script.
FIame7122
(FIame7122)
January 14, 2021, 1:07am
#14
Wait, I made a some typos in the code. Also any errors?
Scrixptz
(Scrixptz)
January 14, 2021, 1:09am
#15
function Tch(h)
if hit.Parent.Name == “Plate” then
hit.Parent:Destroy() “Plate”
local clone = “Bread w/ Plate”
clone.Parent = game.Players:GetPlayerFromCharacter(hit.Parent.Parent).Backpack
end
end
script.Parent.Touched:Connect(function(Tch)
FIame7122
(FIame7122)
January 14, 2021, 1:11am
#16
I asking if their are any errors in the output. You can open the output in the view tab
Scrixptz
(Scrixptz)
January 14, 2021, 1:11am
#17
This is the script that just changes the name:
function tch(h)
if (h.Parent.Name == “Plate”) then
wait(3)
h.Parent.Name = “Plate w/ Bread”
end
end
function S(l)
if l.Parent.Name == “Plate” then
end
end
script.Parent.Touched:connect(tch)
wait()
script.Parent.Touched:connect(S)
Scrixptz
(Scrixptz)
January 14, 2021, 1:13am
#18
It says there is an “expected ‘end’ error”.
FIame7122
(FIame7122)
January 14, 2021, 1:14am
#19
Ok then, ima edit the comment with the code.
Scrixptz
(Scrixptz)
January 14, 2021, 1:15am
#20
Also, do I add this script to the original script that just changed the name?
FIame7122
(FIame7122)
January 14, 2021, 1:16am
#21
I think the error is in the other script. The error in the code was just typo. I edited the script.