Ending Event not working - Its breaking my game

it works now! thank you soo soo much!

the only problem is this script doesnt work anymore.

local RP = game:GetService("ReplicatedStorage")
local Events = RP.Events

local prompt = workspace.Cafe.Inside.Plate.Placement.ProximityPrompt

local folder = game.Workspace.Cafe.Inside.Plate.Placement.Items

prompt.Triggered:Connect(function(plr)
	for _,v in pairs(folder:GetChildren()) do
		if v:IsA("Part") then
			print("There is something inside of the folder! Checking the name;"..v.name.Value)
				if v.name.Value == "Muffin" then
				
					script.Parent.EndingName.Text = "Muffin"
					script.Parent.Desc.Text = "It was stale due to being left out for too long. Gross!"
				
				elseif v.name.Value == "Donuts" then
				
					script.Parent.EndingName.Text = "Donuts"
					script.Parent.Desc.Text =  "How are you gonna finish them all?"		
				
			end
		end
	end
end)

image

its the NameChecking one.
How can I fix this?

does it print if anything is in the folder
are there actually parts in the folder when the prompt is triggered

1 Like

the script just doesnt work. it doesnt print anything.

but yes there is parts in the folder for both the server and the client now!

print when the prompt is triggered to make sure the script is actually detecting when its triggered

1 Like

it prints twice when the prompt is triggered
image

print when looping (not under the IsA(“Part”))

1 Like

it doesnt print anything :thinking:

so i guess it doesnt even loop?

no that means the client doesnt think anything is in the folder

1 Like

thats weird cuz i checked on the client side and it still shows up in the folder? and also for this seperate script

local RP = game:GetService("ReplicatedStorage")
local Events = RP.Events
local prompt = workspace.Cafe.Inside.Plate.Placement.ProximityPrompt

script.Parent.ChildAdded:Connect(function(item)
	prompt.Triggered:Connect(function(plr)
		local inv = plr:FindFirstChild("Inventory")
		for _,v in pairs(inv:GetChildren()) do
			if v:IsA("Part") then
				print("Player has an item! Detecting if it's purchased or not...")
				if v.Purchased.Value == false then
					print("You need to purchase the item first!")
				else
					print("Player has purchased item! Giving ending..")
					item:Destroy()
					end
				end
			end
	end)
end)

it works completely fine, prints stuff and everything

where did you put the print in the not working script

1 Like

look at line 10

local RP = game:GetService("ReplicatedStorage")
local Events = RP.Events

local prompt = workspace.Cafe.Inside.Plate.Placement.ProximityPrompt

local folder = game.Workspace.Cafe.Inside.Plate.Placement.Items

prompt.Triggered:Connect(function(plr)
	for _,v in pairs(folder:GetChildren()) do
		print("test")
		if v:IsA("Part") then
			print("There is something inside of the folder! Checking the name;"..v.name.Value)
				if v.name.Value == "Muffin" then
				
					script.Parent.EndingName.Text = "Muffin"
					script.Parent.Desc.Text = "It was stale due to being left out for too long. Gross!"
				
				elseif v.name.Value == "Donuts" then
				
					script.Parent.EndingName.Text = "Donuts"
					script.Parent.Desc.Text =  "How are you gonna finish them all?"		
				
			end
		end
	end
end)

Try to check if Part is BasePart:

local RP = game:GetService("ReplicatedStorage")
local Events = RP.Events

local prompt = workspace.Cafe.Inside.Plate.Placement.ProximityPrompt

local folder = game.Workspace.Cafe.Inside.Plate.Placement.Items

prompt.Triggered:Connect(function(plr)
	for _,v in pairs(folder:GetChildren()) do
		print("test")
		if v:IsA("BasePart") then
			print("There is something inside of the folder! Checking the name;"..v.name.Value)
				if v.name.Value == "Muffin" then
				
					script.Parent.EndingName.Text = "Muffin"
					script.Parent.Desc.Text = "It was stale due to being left out for too long. Gross!"
				
				elseif v.name.Value == "Donuts" then
				
					script.Parent.EndingName.Text = "Donuts"
					script.Parent.Desc.Text =  "How are you gonna finish them all?"		
				
			end
		end
	end
end)
1 Like

That didnt do anything. The loop is not the issue (i think.) because it works for other scripts.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.