Answered by
4 years ago Edited 4 years ago
Hello! I hope you're having a great day :D
I can see your struggling with properly and efficiently using the TextBox
. Instead of using a while true loop, I recommend you use the GetPropertyChangedSignal("Text")
what this does is every time text is changed the event fires, this way we use less load on the server and don't ultimately crash it.
Now, I also see a second problem which is you have multiple parts in the workspace you want to change the transparency of, no problem this is easy to fix by using a simple for loop which I'll show in a second.
Here is the code I've updated for you assuming this is a serverscript:
01 | local players = game:GetService( "Players" ) |
03 | players.PlayerAdded:Connect( function (plr) |
04 | local textbox = plr.PlayerGui.Ticket.Entered |
06 | textbox:GetPropertyChangedSignal( "Text" ):Connect( function () |
07 | if text = = 'bobman' then |
08 | for i,v in pairs (game.Workspace:GetChildren()) do |
09 | if v.Name = = 'Part' then |
Basically our for loop changes every part with the name "Part" transparency to 0.5, whent he text 'bobman' is entered, which you can of course change.
Hopefully, I helped you today ;D
Thanks for reading,
- DrShockz