You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
After a couple runs of the script, multiple things trigger at once -
What is the issue? Include screenshots / videos if possible!
The customer value that I WANTED to add to the player’s leaderstat value was just multiplying each time because of it. Of course, since it is around 300 lines of code in the script, I am not sure which part of the script is the error(which is not being put into the output, there are no errors because I put them in pcalls since there is no way that I know to fix them)
I also have a waitforchild infinite yeild possible, which is inside of an I, V in pairs loop
Screenshot:
I have no idea if this works or not I just pressed upload, if it doesn’t I will let you know in comments/Idk if there is an edit thing because I haven’t posted on here before since I am afraid to, I am not the best with grammar.
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have tried to put the errors in pcalls, so the output would not give me errors since, that IS originally what I thought was causing my issue, since I have no explanation for this, I have not found anything on the Developer Hub remotely relating to my problem.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
ALSO for the script, I might do the whole script since idk what is happening, but with my best guess I think it may be with the ClickDetector ones, I have tried changing them around but to no avail.
I have also made a duplicate of the place in it’s current state right now, and then made it uncopylocked so you can check it out if there is anything other than this script that is wrong
Uncopylocked game here: didn’t get to it
game.Workspace.Checkout.CheckoutItems.DrinkHolder.ClickDetector.MouseClick:Connect(function()
print("Triggered")
game.SoundService.Background.Playing = false
game.SoundService.MenuHorrorMusic.Playing = false
game.SoundService.Gameplay.Playing = true
game.SoundService.KAREN.Playing = false
--//Setting Items
game.Workspace.Checkout.CheckoutItems.DrinkHolder.ClickDetector.MaxActivationDistance = 0
game.Workspace.Checkout.CheckoutItems.DrinkHolder.SurfaceGui.Enabled = false
--//Variables
local plr = game.Players.LocalPlayer
local char = plr.Character
local hum = char.Humanoid
local humanoidroot = char.HumanoidRootPart
local itemstart = game.Workspace.ItemStart
local itemchecck = game.Workspace.ItemCheck
local itemintermission = game.Workspace.ItemIntermission
local itemend = game.Workspace.ItemEnd
--//Table Variables
local customer = game.Lighting.CashierGame.Customers.Customer:GetChildren()
local Color = game.Lighting.CashierGame.Customers.Colors:GetChildren()
local faces = game.Lighting.CashierGame.Customers.Faces:GetChildren()
local animations = game.Lighting.CashierGame.Customers.Animations:GetChildren()
local hair = game.Lighting.CashierGame.Customers.Hair:GetChildren()
local itemHOlder = game.Lighting.CashierGame.Customers.ItemHolder:GetChildren()
local pants = game.Lighting.CashierGame.Customers.Pants:GetChildren()
local shirts = game.Lighting.CashierGame.Customers.Shirt:GetChildren()
local tshirts = game.Lighting.CashierGame.Customers.TShirt:GetChildren()
--//Randomization Variables
local customerRandom = math.random(1, #customer)
local colorRandom = math.random(1, #Color)
local facesRandom = math.random(1, #faces)
local animationsRandom = math.random(1, #animations)
local hairRandom = math.random(1, #hair)
local itemHolderRandom = math.random(1, #itemHOlder)
local pantsRandom = math.random(1, #pants)
local shirtsRandm = math.random(1, #shirts)
local tshirtsRandom = math.random(1, #tshirts)
local customerT = customer[customerRandom].HumanoidRootPart
--//Copied and Pasted Varaibles
local ClosedWaypoint = game.Workspace.customerturn
local OpenedWaypoint = game.Workspace.customermiddle
local debounce = true
local isOpened = false
local TweenService = game:GetService("TweenService")
local Tween = TweenInfo.new(1.5, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0)
local Tween4 = TweenInfo.new(1.5, Enum.EasingStyle.Sine, Enum.EasingDirection.In, 0, false, 0)
local Twee2n = TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0)
local Tween3 = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0)
local CPOS = {CFrame = ClosedWaypoint.CFrame}
local OPOS = {CFrame = OpenedWaypoint.CFrame}
local POSCheck = {CFrame = itemchecck.CFrame}
local TWEENCAM = game.Workspace.CurrentCamera
local CAMPOS = {CFrame = game.Workspace.Camera2.CFrame}
local POSIntermission = {CFrame = itemintermission.CFrame}
local POSItemend = {CFrame = itemend.CFrame}
local CAMTWEEN = TweenService:Create(TWEENCAM, Tween4, CAMPOS)
local Turn = TweenService:Create(customerT, Twee2n, CPOS)
local Middle = TweenService:Create(customerT, Tween, OPOS)
local set = script.Settings
local sp = set.Speed
local enabled = set.Enabled
local humanim = customer[customerRandom].Humanoid:LoadAnimation(script.IdleAnimation)
local angrywalk = customer[customerRandom].Humanoid:LoadAnimation(script.AngryWalk)
local angrykaren = customer[customerRandom].Humanoid:LoadAnimation(script.KarenStance)
local humanim2 = hum:LoadAnimation(script.Checkout)
hum.WalkSpeed = 0
hum.JumpPower = 0
char.Torso.CFrame = game.Workspace.registerteleportr.CFrame
plr.PlayerGui.Lookbuttongui.Back.Visible = false
plr.PlayerGui.Lookbuttongui.LookAround.Visible = false
--//Start
customer[customerRandom].Parent = game.Workspace
Color[colorRandom].Parent = customer[customerRandom]
faces[facesRandom].Parent = customer[customerRandom].Head
hair[hairRandom].Parent = customer[customerRandom]
pants[pantsRandom].Parent = customer[customerRandom]
shirts[shirtsRandm].Parent = customer[customerRandom]
tshirts[tshirtsRandom].Parent = customer[customerRandom]
customer[customerRandom].Torso.CFrame = game.Workspace.customerstart.CFrame
local fruit = game.Lighting.CashierGame.Items.FoodItems:GetChildren()
local fruitranodm = math.random(1, #fruit)
local newfruit = fruit[fruitranodm]:Clone()
if newfruit.Golden.Value == true then
game.SoundService.Sounds.GoldenItem.Playing = true
end
local itemchecktween = TweenService:Create(newfruit.Main, Tween3, POSCheck)
local itemintermissiontwewen = TweenService:Create(newfruit.Main, Tween3, POSIntermission)
local itemendtween = TweenService:Create(newfruit.Main, Tween3, POSItemend)
if faces[facesRandom].Name == "Karen" then
local camera = game.Workspace.CurrentCamera
game.SoundService.Background.Playing = false
game.SoundService.MenuHorrorMusic.Playing = false
game.SoundService.Gameplay.Playing = false
game.SoundService.KAREN.Playing = true
script.Parent.GUIS.Karen.Visible = true
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = game.Workspace.KarenLook1.CFrame
wait(1)
script.Parent.GUIS.Karen.Visible = false
camera.CFrame = game.Workspace.KarenLook2.CFrame
wait(1)
script.Parent.GUIS.Karen.Visible = true
wait(1)
script.Parent.GUIS.Karen.Visible = false
wait(1)
camera.CFrame = game.Workspace.CashierLook1.CFrame
script.Parent.GUIS.Karen.Visible = true
wait(1)
camera.CFrame = game.Workspace.CashierLook2.CFrame
script.Parent.GUIS.Karen.Visible = false
wait(1)
camera.CFrame = game.Workspace.CameraTweener.CFrame
script.Parent.GUIS.Karen.Visible = false
angrywalk:Play()
Middle:Play()
CAMTWEEN:Play()
wait(1)
wait(0.5)
Turn:Play()
wait(0.5)
angrywalk:Stop()
wait(1)
camera.CameraType = Enum.CameraType.Custom
wait(1.5)
angrykaren:Play()
else
wait(1)
humanim:Play()
Middle:Play()
wait(1.5)
Turn:Play()
wait(0.5)
humanim:Stop()
wait(1)
end
newfruit.Parent = game.Workspace
newfruit.Main.CFrame = game.Workspace.ItemStart.CFrame
newfruit.Main.ClickDetector.MouseClick:Connect(function()
newfruit.Main.ClickDetector:Destroy()
newfruit.Main.Anchored = true
itemchecktween:Play()
humanim2:Play()
wait(1)
game.Workspace.Scan.Transparency = 0
game.Workspace.ScanSound.Playing = true
script.GuiScripts.Fruit.Apple:Clone().Parent = newfruit.Gui
newfruit.Gui.Apple.Disabled = false
local temp = game.Workspace.Checkout.CheckoutItems.CheckoutTech.Screen1.SurfaceGui.ItemInfo.Total.total
temp.Value = temp.Value + newfruit.Gui.Price.Value
newfruit.Gui.Parent = game.Workspace.Checkout.CheckoutItems.CheckoutTech.Screen1.SurfaceGui.itemLIst
wait(0.339)
game.Workspace.Scan.Transparency = 1
wait(1)
itemintermissiontwewen:Play()
wait(1)
itemendtween:Play()
wait(1)
humanim2:Stop()
newfruit.Main.Anchored = false
newfruit.Ready.Value = true
local seconder = game.ReplicatedStorage.Second:Clone()
seconder.Parent = newfruit.Main
end)
pcall(function()
newfruit.Main:WaitForChild("Second").MouseClick:Connect(function()
if game.Workspace.Bags.Bag.Value == true then
newfruit:Destroy()
local lighting = game.Lighting.CashierGame.Bags.Filled:GetChildren()
local random = math.random(1, #lighting)
local bags = game.Workspace.Bags.Bags:GetChildren()
local ranodm2 = math.random(1, #bags)
lighting[random]:Clone().Parent = game.Workspace
lighting[random].Bag.Position = bags[ranodm2].Position
lighting[random].randomizer.Position = lighting[random].Bag.Position
bags[ranodm2].bagspawn.Parent = game.Workspace.Checkout.Bagging.BagPositions
bags[ranodm2]:Destroy()
game.Workspace.Checkout.CheckoutItems.Done.Transparency = 0
game.Workspace.Checkout.CheckoutItems.Done.SurfaceGui.Enabled = true
game.Workspace.Checkout.CheckoutItems.Done.ClickDetector.MaxActivationDistance = 32
game.Workspace.Checkout.CheckoutItems.Done.ClickDetector.MouseClick:Connect(function()
game.SoundService.Sounds.GoldenItem.TimePosition = 0
game.Workspace.Checkout.CheckoutItems.Done.Transparency = 1
game.Workspace.Checkout.CheckoutItems.Done.SurfaceGui.Enabled = false
game.Workspace.Checkout.CheckoutItems.Done.ClickDetector.MaxActivationDistance = 0
if faces[facesRandom].Name == "Karen" then
script.Parent.Manager.Enabled = true
local label = script.Parent.Manager.MANAGER
label.Selectable = false
local tweenservice = game:GetService("TweenService")
local rot = label.Rotation
local tweeninfo = TweenInfo.new(0.25, Enum.EasingStyle.Sine, Enum.EasingDirection.In, 0, false, 0)
local tween = TweenService:Create(label, tweeninfo, {Rotation = rot == 5 and 0 or 5})
tween:Play()
local tween2 = TweenService:Create(label, tweeninfo, {Rotation = rot == -5 and 0 or -5})
tween.Completed:Wait()
tween2:Play()
tween2.Completed:Wait()
local back = TweenService:Create(label, tweeninfo, {Rotation = rot == 0 and 0 or 0})
back:Play()
label.MouseButton1Click:Connect(function()
local manager = game.Lighting.CashierGame.Managers:GetChildren()
local random = math.random(1, #manager)
manager[random].Parent = game.Workspace
local anim = manager[random].Humanoid:LoadAnimation(script.IdleAnimation)
local root = manager[random].HumanoidRootPart
root.CFrame = game.Workspace.ManagerStart.CFrame
local tweeninfo = TweenInfo.new(4, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0)
local tweeninfo2 = TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0)
local tweeninfo3 = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.In, 0, false, 0)
local pos1 = {CFrame = game.Workspace.Manager2.CFrame}
local pos2 = {CFrame = game.Workspace.ManagerTurn.CFrame}
local pos3 = {CFrame = game.Workspace.ManagerEnd.CFrame}
local tween1 = TweenService:Create(root, tweeninfo, pos1)
local tween2 = TweenService:Create(root, tweeninfo2, pos2)
local tween3 = TweenService:Create(root, tweeninfo3, pos3)
local anim2 = manager[random].Humanoid:LoadAnimation(script.Punch)
anim:Play()
tween1:Play()
tween1.Completed:Wait()
tween2:Play()
tween2.Completed:Wait()
tween3:Play()
tween3.Completed:Wait()
anim:Stop()
wait(2)
anim2:Play()
wait(0.5)
local tweeninfo1 = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.In, 0, false, 0)
local tweeninfo22 = TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0)
local tweeninfo33 = TweenInfo.new(4, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0)
local pos11 = {CFrame = game.Workspace.ManagerTurn23.CFrame}
local pos22 = {CFrame = game.Workspace.ManagerStart2.CFrame}
local pos33 = {CFrame = game.Workspace.ManagerEnd2.CFrame}
local pos12 = {CFrame = game.Workspace.ManagerTurn2.CFrame}
local tween11 = TweenService:Create(root, tweeninfo1, pos11)
local tween12 = TweenService:Create(root, tweeninfo22, pos12)
local tween22 = TweenService:Create(root, tweeninfo22, pos22)
local tween33 = TweenService:Create(root, tweeninfo33, pos33)
customer[customerRandom].Parent = game.Lighting.CashierGame.Customers.Customer
Color[colorRandom].Parent = game.Lighting.CashierGame.Customers.Colors
faces[facesRandom].Parent = game.Lighting.CashierGame.Customers.Faces
hair[hairRandom].Parent = game.Lighting.CashierGame.Customers.Hair
pants[pantsRandom].Parent = game.Lighting.CashierGame.Customers.Pants
shirts[shirtsRandm].Parent = game.Lighting.CashierGame.Customers.Shirt
tshirts[tshirtsRandom].Parent = game.Lighting.CashierGame.Customers.TShirt
anim:Play()
tween22:Play()
tween22.Completed:Wait()
tween12:Play()
tween12.Completed:Wait()
tween11:Play()
tween11.Completed:Wait()
tween33:Play()
tween33.Completed:Wait()
anim:Stop()
manager[random].Parent = game.Lighting.CashierGame.Managers
label.Selectable = true
game.SoundService.Background.Playing = true
game.SoundService.MenuHorrorMusic.Playing = false
game.SoundService.Gameplay.Playing = false
game.SoundService.KAREN.Playing = false
game.SoundService.Sounds.GoldenItem.Playing = false
game.SoundService.KAREN.TimePosition = 0
game.Workspace.Checkout.CheckoutItems.DrinkHolder.ClickDetector.MaxActivationDistance = 6
game.Workspace.Checkout.CheckoutItems.DrinkHolder.SurfaceGui.Enabled = true
plr.PlayerGui.Lookbuttongui.LookAround.Visible = true
plr.leaderstats.Money.Value = plr.leaderstats.Money.Value + 0
game.SoundService.Sounds.Cash.Playing = true
game.Workspace.Checkout.CheckoutItems.CheckoutTech.Screen1.SurfaceGui.ItemInfo.Total.total.Value = game.Workspace.Checkout.CheckoutItems.CheckoutTech.Screen1.SurfaceGui.ItemInfo.Total.total.Value - game.Workspace.Checkout.CheckoutItems.CheckoutTech.Screen1.SurfaceGui.itemLIst.Gui.Price.Value
game.Workspace.Checkout.CheckoutItems.CheckoutTech.Screen1.SurfaceGui.itemLIst.Gui:Destroy()
end)
else
game.SoundService.Background.Playing = true
game.SoundService.MenuHorrorMusic.Playing = false
game.SoundService.Gameplay.Playing = false
game.SoundService.KAREN.Playing = false
game.SoundService.Sounds.GoldenItem.Playing = false
customer[customerRandom].Parent = game.Lighting.CashierGame.Customers.Customer
Color[colorRandom].Parent = game.Lighting.CashierGame.Customers.Colors
faces[facesRandom].Parent = game.Lighting.CashierGame.Customers.Faces
hair[hairRandom].Parent = game.Lighting.CashierGame.Customers.Hair
pants[pantsRandom].Parent = game.Lighting.CashierGame.Customers.Pants
shirts[shirtsRandm].Parent = game.Lighting.CashierGame.Customers.Shirt
tshirts[tshirtsRandom].Parent = game.Lighting.CashierGame.Customers.TShirt
game.SoundService.KAREN.TimePosition = 0
game.Workspace.Checkout.CheckoutItems.DrinkHolder.ClickDetector.MaxActivationDistance = 6
game.Workspace.Checkout.CheckoutItems.DrinkHolder.SurfaceGui.Enabled = true
plr.PlayerGui.Lookbuttongui.LookAround.Visible = true
plr.leaderstats.Money.Value = plr.leaderstats.Money.Value + game.Workspace.Checkout.CheckoutItems.CheckoutTech.Screen1.SurfaceGui.ItemInfo.Total.total.Value
game.SoundService.Sounds.Cash.Playing = true
game.Workspace.Checkout.CheckoutItems.CheckoutTech.Screen1.SurfaceGui.ItemInfo.Total.total.Value = game.Workspace.Checkout.CheckoutItems.CheckoutTech.Screen1.SurfaceGui.ItemInfo.Total.total.Value - game.Workspace.Checkout.CheckoutItems.CheckoutTech.Screen1.SurfaceGui.itemLIst.Gui.Price.Value
game.Workspace.Checkout.CheckoutItems.CheckoutTech.Screen1.SurfaceGui.itemLIst.Gui:Destroy()
end
end)
end
end)
end)
end)
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.