Why are you defining the playergui in a server script? I’m assuming it’s a server script because you are using FireAllClients with the remote event from ReplicatedStorage, if you want to define the PlayerGui then it needs to be in a client script (local script)
u can use playergui in a server script, i also did this with another part touch and the ending text shows for that, its the exact same script as that except the text is different like here its Car Crash, for the other its Drown
From the looks of it it should be working fine. Maybe your screengui is disabled? Is something up with your values? You could print stuff out throughout to script to check which parts of it are even working in the first place.
I copied your script but removed the parts where it checked values and tweened the imagelabel to not have to recreate your entire system. It worked well for me.
This should work as long as you have everything like the Guis setup correctly, I also shortened and cleaned up the code a bit for you for readability-sake
local BadgeService = game:GetService("BadgeService")
local PlayerService = game:GetService("Players")
script.Parent.Touched:Connect(function(otherPart)
if otherPart.Parent:FindFirstChild("HumanoidRootPart") then
local character = otherPart.Parent
local player = PlayerService:GetPlayerFromCharacter(character)
-- do all your value changing stuff here (although it will be inside of the character and NOT the player which i reccommend)
BadgeService:AwardBadge(player.UserId, 2992784962412130)
local playerGui = player:FindFirstChild("PlayerGui")
if playerGui then
local endGui = playerGui:WaitForChild("EndingFoundText") -- make sure EndingFoundText is a ScreenGui, of course
local ending = player:FindFirstChild("Ending").Value
endGui.Enabled = true
endGui.EndingText.Text = "your ending: " .. ending
endGui.ImageLabel:TweenSizeAndPosition(UDim2.fromScale(4.862, 0, 4.988), UDim2.fromScale(-1.994, -1.994), Enum.EasingDirection.InOut, Enum.EasingStyle.Quad, 0.5)
task.wait(1.5)
endGui.EndingText.Visible = true
end
end
end)
Recommended
think of firing a RemoteEvent to the Player to handle their GUI rather than fetching PlayerGui on the Server and doing all the Tweens here too… just for optimization
What he means by this is, when firing Tweens or handling almost any kind of movement (player, GUI, objects, VFX and much more… you should handle it on the Client (the players device) rather than running it on the ROBLOX Servers as this will cause lag, FPS drops and an unpleasant and overall delayed experience… You used Remotes in your original script to “FreezeEverything” and “DisableReset” which is a good start but as I said, fire a Remote to the Player who got the ending and then receive that through a Local Script and run all the GUI Tweens on that Script
you shouldn’t run animations or tweens on the server
for example, if you tween a part CFrame on the server the server will send the CFrame 60 times every second and it will be delayed depending on the clients PING which will make it not look smooth also it will increase the incoming network