local A = script.Parent.Blocks.A local B = script.Parent.Blocks.B local C = script.Parent.Blocks.C local D = script.Parent.Blocks.D local Admins ={"Kitorari"} local Prefix = "-" for i,v in pairs(Admins) do game.Players:WaitForChild(Admins[i]).Chatted:Connect(function(Msg) if Msg:lower() == Prefix .. "Begin" then repeat A.CFrame = CFrame.new(A.Position + Vector3.new(0.01, 0, 0.01)) wait(1) until false end end) end
I tried using the command -Begin but it doesn't work, What i'm trying to do is move the block to a different position ((No idea what that is yet thus the repeat)) but I'm not sure how.
Any assistance would be welcomed and appreciated ;u;
The problem that you are likely facing is that Msg:lower()
is always going to be lowercase, but you are comparing it to a string containing an uppercase character. Hence the value
Msg:lower() == Prefix .. "Begin"
will always evaluate to false
, and so your command will never be executed. You can fix this by changing "Begin" to "begin".
Also, keep in mind that using WaitForChild
in this situation is a bad idea. If at any point you add another player as admin, your current script may wait forever for that player to join the game, thus preventing other admins who may join your game from being able to use the commands. You should use game.Players.PlayerAdded
instead to connect players' chat events.
I would also recommend having the Admins
table keep track of admins by user ID instead of by username, as players may change their usernames over time.