BoblokDevelopyyyr

ChangeShape(LocalScript)

Jan 4th, 2025
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.77 KB | None | 0 0
  1. local RS = game:GetService("ReplicatedStorage")
  2. local ev = RS.RemoteEvent
  3.  
  4. local textBox = script.Parent
  5. local text = textBox.Text
  6. local shape = ""
  7. local shapes = {"Ball", "Wedge", "Cylinder", "Block"}
  8. print(shapes[1])
  9. local function checkForText()
  10.    
  11.     if textBox.Text == shapes[1] then
  12.         shape = shapes[1]
  13.     end
  14.     if textBox.Text == shapes[2] then
  15.         shape = shapes[2]
  16.     end
  17.     if textBox.Text == shapes[3] then
  18.         shape = shapes[3]
  19.     end
  20.     if textBox.Text == shapes[4] then
  21.         shape = shapes[4]
  22.     end
  23. end
  24.  
  25. textBox.Changed:Connect(checkForText)
  26.  
  27. textBox.Changed:Connect(function(_)
  28.     checkForText()
  29.     if shape == shapes[1] or shape == shapes[2] or shape == shapes[3] or shape == shapes[4] then
  30.         ev:FireServer(shape)
  31.     else
  32.         print("Invalid shape!")
  33.         return
  34.     end
  35.  
  36. end)
Add Comment
Please, Sign In to add comment