So the core of my game is basically getting endings, and my whole system just suddenly decided to stop working? I’ve been trying solutions for months and I can’t create anything without endings. It’s literally breaking my game.
Here’s my ‘name checking’ scripts, basically checking the name of the food and giving the proper ending to it. I’ve made them in separate scripts because I thought that you can only give a badge from a regular script and not a local script.
Name checking script 1:
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)
this local script checks the name of the object and changes the text based off of it, it is parented to a frame inside of startergui.
Name checking script 2:
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
Events.GiveEnding:FireClient(plr, "Classic.", 2147132836)
elseif v.name.Value == "Donuts" then
Events.GiveEnding:FireClient(plr,"mm", 2147434744)
end
end
end
end)
this is a regular script still parented to a frame inside starter gui. I have moved it to serverscriptservice it still doesnt work. it’s supposed to give you a badge based off of the ending you get.
This is another ending handler inside of the same frame inside of starter gui:
local TweenService = game:GetService("TweenService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Events = ReplicatedStorage.Events
local sound = game.Workspace.Music["splat.wav"]
Events:FindFirstChild("GiveEnding").OnClientEvent:Connect(function()
script.Parent.Visible = true
local newpos = UDim2.new(-0.001, 0, -0, 0)
local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out)
local tween = TweenService:Create(script.Parent, tweenInfo, {Position = newpos})
tween:Play()
wait(2)
script.Parent["Ending:"].Visible = true
sound:Play()
wait(2)
script.Parent.EndingName.Visible = true
sound:Play()
wait(3)
sound:Play()
script.Parent.Desc.Visible = true
end)
its a local script and it basically functions so that when you put a food on the plate, it shows the ending screen. this hasnt been working at all, it hasnt been even showing up. ive tried making it a local script and changing the event, and a regular script and changing the event. it still doesnt work.
idk why you would need this, but just in case here is the script for when you place food on the plate overall.
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..")
v.Parent = workspace.Cafe.Inside.Plate.Placement.Items
v.Position = workspace.Cafe.Inside.Plate.Placement.TP.Position
v:FindFirstChild("Attachment").ProximityPrompt:Destroy()
prompt.Enabled = false
plr.Character.HumanoidRootPart.CFrame = CFrame.new(workspace.Cafe.Inside.SpawnTp.Position)
plr.Character:FindFirstChild("Humanoid").WalkSpeed = 0
plr.Character:FindFirstChild("Humanoid").Sit = true
plr.Character.HumanoidRootPart.Anchored = true
item:Destroy()
Events.PlacementEvent:FireServer()
wait(2)
end
end
end
end)
end)
theres a few other scripts if you need them but these im basically having the most trouble with. thank you for reading and im sorry its so long, last post i did that was long like this i couldnt get any help
seriously though i dont know the issue and ive tried a billion things. if you need more scripts and stuff i will gladly oblige