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:
local players = game:GetService("Players")
players.PlayerAdded:Connect(function(plr)
local textbox = plr.PlayerGui.Ticket.Entered
textbox:GetPropertyChangedSignal("Text"):Connect(function()
if text == 'bobman' then
for i,v in pairs(game.Workspace:GetChildren()) do
if v.Name == 'Part' then
v.Transparency = 0.5
end
end
end
end)
end)
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,
4 comments
Many people have tried to help me but every way wouldnt work.
Is it a server script or local script?
local script
Have you read my answer? I spent 20 minutes writing an answer not for it to be ignored, so if you could check it out thanks.