Are there anyways to make this script shorter?
This script is inside a tool
local tool = script.Parent
local UpperLeft = tool.First
local UpperRight = tool.Sec
local LowerLeft = tool.Third
local LowerRight = tool.Fourth
local Aweld = UpperLeft.WeldConstraint
local Bweld = UpperRight.WeldConstraint
local Cweld = LowerLeft.WeldConstraint
local Dweld = LowerRight.WeldConstraint
local Afull = false
local Bfull = false
local Cfull = false
local Dfull = false
local equiped = false
--prompts--
local pasteries = game.Workspace.counter.Pasteries.Bread
local breadroll = pasteries.BreadRoll.ProximityPrompt
local BreadSlice = pasteries.BreadSlice.ProximityPrompt
--give--
tool.Equipped:Connect(function()
equiped = true
end)
tool.Unequipped:Connect(function()
equiped = false
end)
--triggers--
breadroll.Triggered:Connect(function()
if equiped == true then
local clone = breadroll.Parent.Dupe:Clone()
clone.Anchored = false
clone.Name = breadroll.Parent.Name
if Afull == false then
clone.Parent = UpperLeft
clone.CFrame = UpperLeft.CFrame
Aweld.Part0 = UpperLeft
Aweld.Part1 = clone
Afull = true
elseif Bfull == false then
clone.Parent = UpperRight
clone.CFrame = UpperRight.CFrame
Bweld.Part0 = UpperRight
Bweld.Part1 = clone
Bfull = true
elseif Cfull == false then
clone.Parent = LowerLeft
clone.CFrame = LowerLeft.CFrame
Cweld.Part0 = LowerLeft
Cweld.Part1 = clone
Cfull = true
elseif Dfull == false then
clone.Parent = LowerRight
clone.CFrame = LowerRight.CFrame
Dweld.Part0 = LowerRight
Dweld.Part1 = clone
Dfull = true
end
elseif equiped == false then
print("plate not equipted")
end
end)
BreadSlice.Triggered:Connect(function(give)
if equiped == true then
local clone = BreadSlice.Parent.Dupe:Clone()
clone.Anchored = false
clone.Name = BreadSlice.Parent.Name
if Afull == false then
clone.Parent = UpperLeft
clone.CFrame = UpperLeft.CFrame
Aweld.Part0 = UpperLeft
Aweld.Part1 = clone
Afull = true
elseif Bfull == false then
clone.Parent = UpperRight
clone.CFrame = UpperRight.CFrame
Bweld.Part0 = UpperRight
Bweld.Part1 = clone
Bfull = true
elseif Cfull == false then
clone.Parent = LowerLeft
clone.CFrame = LowerLeft.CFrame
Cweld.Part0 = LowerLeft
Cweld.Part1 = clone
Cfull = true
elseif Dfull == false then
clone.Parent = LowerRight
clone.CFrame = LowerRight.CFrame
Dweld.Part0 = LowerRight
Dweld.Part1 = clone
Dfull = true
end
elseif equiped == false then
print("plate not equipted")
end
end)