what the script is supposed to do is when i press "R" it will remove my humanoid and then make me respawn after 3 seconds, which it does. But it's also supposed to make this ScreenGui pop up saying "YOU FOOL" but it only pops up after i respawn. It even puts it in the wrong spot! Please help me if you know the answer to my problem and my script is:
local UIS = game:GetService('UserInputService') local player = game.Players.LocalPlayer UIS.InputBegan:Connect(function(input, poo) if poo then return end if input.KeyCode == Enum.KeyCode.R then local hum = player.Character:WaitForChild('Humanoid') if hum ~= nil then game.StarterGui.youfool.TextLabel.Position = UDim2.new({0.384, 0},{0.409, 0}) wait(0.1) hum:Destroy() wait(3) player:LoadCharacter() end end end)
and yes i put the ScreenGui in the right place for the script
it also is a local script
For your first problem This is because you assume that the gui is still in the startergui, wich isn't the case.
Well, kinda, it gets cloned to the player, so what happends it, you change the gui, when the player dies, it gets cloned again, and the positions changes
It gets cloned to the playergui, so it would end up something like this (line 9)
player:WaitForChild('PlayerGui').youfool.TextLabel.Position = UDim2.new({0.384, 0},{0.409, 0})
For your second problem I saw that you used size for the size, so that part is right, so you probably used offset for the position, I don't know this though, so I can't answer that, if you can't solve it add a screenshot or so from the location, the place, and the properties (size and position)
If you have any more questions, just ask
(Also, if ... ~= nil
then isn't neccesary, it's the same as if ... then
)
EDIT (after reading your comment)
It depends on if you're using FE or not
Without FE: It would change for every player, as the contents of startergui get cloned to the playergui for every player
With FE: It would change for you, as local scripts cannot change things in the server (without the use of remotes)