You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
require a modulescript
What is the issue? Include screenshots / videos if possible!
when requiring, the whole script stops
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
no solutions matched my script
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
my initial goal is to create a spectate system but hides the toggle button if player is currently in round or no players to spectate
my game system uses a module script to find the players that are in a match
print("script loaded 1") repeat wait() until game:IsLoaded() --for some reason, still needs :WaitForChild() local button = script.Parent.Toggle local frame = script.Parent.Frame local title = frame.SubjectName local left = frame["<"] local right = frame[">"] local cam = workspace.CurrentCamera local num = 1 local plr = game.Players.LocalPlayer frame.Visible = false button.Visible = true print("before require") local playing = require(game:GetService("ServerScriptService"):WaitForChild("CurrentlyPlaying") --this is where the script ends print("module loaded") function changeToPlayer() title.Text = plr.Name cam.CameraSubject = plr.Character.Humanoid num = 1 end button.MouseButton1Click:Connect(function() print("click") if frame.Visible == true then frame.Visible = false changeToPlayer() print("hidden frame") else frame.Visible = true changeToPlayer() print("unhidden frame") end end) right.MouseButton1Click:Connect(function() local players = playing local amountofplayers = #players num += 1 if num > amountofplayers then num = 1 end cam.CameraSubject = players[num].Character.Humanoid title.Text = players[num].Name print("right clicked") end) left.MouseButton1Click:Connect(function() local players = playing local amountofplayers = #players num -= 1 if num < amountofplayers then num = amountofplayers end cam.CameraSubject = players[num].Character.Humanoid title.Text = players[num].Name print("left clicked") end) spawn(function() while wait() do if #playing > 0 then if table.find(playing, plr) then button.Visible = false changeToPlayer() print("loop works 1") else button.Visible = true print("loop works 2") end else button.Visible = false changeToPlayer() print("loop works 3") end end end)
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.