Freeze command not working, no errors in the output

  1. What do you want to achieve? Keep it simple and clear!
    I want my character to be freezed and my GUI to show up with the reason.
  2. What is the issue? Include screenshots / videos if possible!
    I simply can still move and I don’t have the freezed GUI, there’s no errors in the output.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried editing my GetPlayer() function but it’s didn’t work since I assume it’s from there the error comes from.
local config = require(game:GetService("ServerScriptService").ParalaxAdmin.Setup)
local freezeData = game:GetService("DataStoreService"):GetDataStore("FREEZESQJCC9D8DAD81E")
local Remote = game:GetService("ReplicatedStorage").ParalaxRemotes:WaitForChild("RemoveResetAbility")
local banData = game:GetService("DataStoreService"):GetDataStore("KSQODADKQONDCQSNCADQSS")

local function GetPlayer(String)
	for i,v in pairs(game.Players:GetPlayers()) do
		if (string.sub(string.lower(v.Name), 1, string.len(String))) == string.lower(String) then
			return v
		end
	end
end

game.Players.PlayerAdded:Connect(function(plr)
	if banData:GetAsync(plr.UserId,true) then
		plr:Kick(config.PermBanMsg)
	end
	if plr:GetRankInGroup(config.GroupID) >= 4 then
		plr.Chatted:Connect(function(msg)
			local args = msg:split(" ")
			if args[1] == ":freeze" then
				if not args[2] then return end
			else
				local target = GetPlayer(args[2])
				local Humanoid = workspace:FindFirstChild(target.Name):FindFirstChild("Humanoid")
				Humanoid.WalkSpeed = 0
				Humanoid.JumpHeight = 0
				local FreezeUI = script.Parent.UI:WaitForChild("Frozen"):Clone()
				FreezeUI.Parent = target.PlayerGui
				if args[3] then
					local rmsg = table.concat(args, " ", 3)
					FreezeUI.Frame.Reason.Text = rmsg
					Remote:FireClient(target)
					freezeData:SetAsync(target.UserId,true)
				else
					Remote:FireClient(target)
					freezeData:SetAsync(target.UserId,true)
				end
			end
		end)
	end
end)

game.Players.PlayerAdded:Connect(function(plr)
	if banData:GetAsync(plr.UserId,true) then
		plr:Kick(config.PermBanMsg..config.SetReasonFreeze)
	end
	if plr:GetRankInGroup(config.GroupID) >= 4 then
		plr.Chatted:Connect(function(msg)
			local args = msg:split(" ")
			if args[1] == ":unfreeze" then
				if not args[2] then return end
			else
				local target = GetPlayer(args[2])
				local Humanoid = workspace:FindFirstChild(target.Name):FindFirstChild("Humanoid")
				if freezeData:GetAsync(target.UserId,true) then
					freezeData:SetAsync(target.UserId,false)
					Humanoid.WalkSpeed = 16
					Humanoid.JumpHeight = 7.2
					target.PlayerGui:WaitForChild("Frozen"):Destroy()
				end
			end
		end)
	end
end)

game.Players.PlayerRemoving:Connect(function(plr)
	if freezeData:GetAsync(plr.UserId,true) then
		banData:SetAsync(plr.UserId,true)
	end
end)

You have all of the freeze command code outside of where it checks if the first argument is the freeze command.

1 Like