Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

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

Asked by 3 months ago

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

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 Azure_Kite 755 — 3mo

1 answer

Log in to vote
0
Answered by 3 months ago

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!

0
Sorry But That does not work ether Retallack445 24 — 3mo
Ad

Answer this question