Roblox Studio doesn't launch code completely

I want the client event to work, but it doesnt!
The problem is Im initializing the client module which setups the events to be called by server, however server can’t throw any of these requests… But the same thing happened with just simple local script code, it couldn’t reach the end of script

heres code of module:

local RunService = game:GetService("RunService")
local IsServer, IsClient = RunService:IsServer(), RunService:IsClient()

if IsClient then
	print("[client side] ragdoll events were initialized")
	local Actions = {
		["Ragdoll"] = function(Character: Model)
			local Humanoid = Character:WaitForChild("Humanoid")
			Humanoid.AutoRotate = false
			Humanoid:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, false)
			Humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, not false)
			Humanoid:SetStateEnabled(Enum.HumanoidStateType.Physics, true)
			Humanoid:ChangeState(Enum.HumanoidStateType.Physics)
		end,
		["Getup"] = function(Character: Model)
			local Humanoid = Character:WaitForChild("Humanoid")
			Humanoid.AutoRotate = true
			Humanoid:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, false)
			Humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, not true)
			Humanoid:SetStateEnabled(Enum.HumanoidStateType.Physics, false)
			Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
		end,
	}
	
	script.RemoteEvent.OnClientEvent:Connect(function(Character: Model, Action)
		print("called ragdoll event!")
		if Actions[Action] then
			Actions[Action](Character)
		end
	end)
end

heres code of local script:

    local ReplicatedStorage = game:GetService("ReplicatedStorage")
    local Ragdoll = require(ReplicatedStorage.ModuleScripts.Ragdoll)
    local Signals = require(ReplicatedStorage.ModuleScripts.Signals)
	local plr = game.Players.LocalPlayer
	repeat
		task.wait()
	until plr.Character and plr.Character:FindFirstChild("Humanoid")
	Ragdoll.Setup(plr.Character)
	Signals.ServerSystemRE:FireServer("load character")
	Signals.ServerSystemRE:FireServer("initialize movement system")

but the most interesting thing is that dev console shows the output:
изображение
this output shows that local script works correctly… Well I thought It maybe was problem with script which call the client event… I tested it but i don’t know why it stops before calling client event and theres no output from client.

also while i was writing this, my client events did their job and activated after bunch of testings:
изображение
so it worked correctly… But why doesn’t it work always?
Also theres no errors in output… NO ERRORS… NO pcall functions… so that it means it must show the errors…

1 Like