Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

I need help with this script. I am trying to size it the the Gui (and i need this ? apearently)

What the script is using:

/ StarterGui / ScreenGui / Frame LocalScript

Script:

local Player = game.Players.LocalPlayer

repeat wait() until Player.Character:FindFirstChild("Torso")

if script.Parent.Size.X.Offset == 100 then script.Parent.Size.X.Offset = script.Parent.Parent.AbsoluteSize.X script.Parent.Size.Y.Offset = script.Parent.Parent.AbsoluteSize.Y end

5 comments

0

I had also checked my other post and found a problem with the Gui reference

0

You should use more variables. It make your code clear to read.

0

yes but i asked how to fix this and i do understand the varriables thing

0

Please also put your code in a code block

0

how would i make a code block?

1 answer

I didn't quite understand what you want to do, but it might be this problem I wrote down. If it's not, it's still good to know to prevent errors on any script that needs to find a character on the beggining of the code.

Local scripts tend to run before your character loads, so it gets an error for trying to reference a nil value (player.Character). So the script probably stops when you want to find that torso.

You can fix this part by using this line:

local character  = player.Character or player.CharacterAdded:Wait()
local torso = character:WaitForChild("Torso") --you dont need to loop to find something, this works as well

This discussion is preserved as it was. New answers, comments, and votes are closed.