local trapPart = script.Parent
local function onPartTouch(otherPart)
local partParent = otherPart.Parent
local humanoid = partParent:FindFirstChildWhichIsA("Humanoid")
if ( humanoid ) then
_G.risespeed = 0.02
game.StarterGui.ScreenGui.TextLabel.Text = humanoid.Name .. " has won!"
wait (5)
humanoid.Health = 0
end
end
trapPart.Touched:Connect(onPartTouch)
This code checks for the player if he touched it, then it makes the risespeed faster and SHOULD change the text label to playerthattouchedtheobject has won! But it only shows humanoid has won. Also It only updates the text when the player dies and not right after touching it which should be it. Anyone could help me with both issues? finding player name that touched it and making it appear when touched and not when he dies.
Any Help would be appreciated

3 comments
Okay so the second code should be in the workspace as a remote event and thats it?
removeevent in code 1 is saying that it dosent recognise the global
Because this code isn't copy paste friendly on purpose. And remotes should be in replicated storage. I'm pretty sure,you know how to declare variables so remote event isn't unrecognized