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

Why does my code not work? I want to make an user chose there gravity

I want to make an user chose there gravity but the code i am using it does not work. This is the code:

local TextBox = script.Parent.Parent.TextBox

game.Workspace.Gravity = TextBox

1 comment

0

That script will only run once when you join the game, you need an event or something to trigger the code to run again, like a button when clicked or when the user press enter

1 answer

I'm assuming you just started in Lua, but the reason it is not working is because you need to use the TextBox's 'Text' value so the gravity can actually change. This is what you'd do:

local TextBox = script.Parent.Parent.TextBox

game.Workspace.Gravity = TextBox.Text

When you have it as that, it will detect a numerical value to set your gravity to, like 100.

Hoped this helped!

1 comment

0

Sorry But That does not work ether

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