Script works in solo test but no in a test server?

I’ve used a simple script to make the rest of a players body visible. But it only works in a local server, not in an actual server. I havent been able to find an answer in the dev forum. Thanks.

This is the script i used (local script in character scripts)

local player = game.Players.LocalPlayer
local char = player.Character
local RunService = game:GetService("RunService")

char.Humanoid.CameraOffset = Vector3.new(0, 0, -1)

for i, v in pairs(char:GetChildren()) do
	if v:IsA("BasePart") and v.Name ~= "Head" then

		v:GetPropertyChangedSignal("LocalTransparencyModifier"):Connect(function()
			v.LocalTransparencyModifier = v.Transparency
		end)

		v.LocalTransparencyModifier = v.Transparency

	end
end

RunService.RenderStepped:Connect(function(step)
	local ray = Ray.new(char.Head.Position, ((char.Head.CFrame + char.Head.CFrame.LookVector * 2) - char.Head.Position).Position.Unit)
	local ignoreList = char:GetChildren()

	local hit, pos = game.Workspace:FindPartOnRayWithIgnoreList(ray, ignoreList)

	if hit then
		char.Humanoid.CameraOffset = Vector3.new(0, 0, -(char.Head.Position - pos).magnitude)
	else
		char.Humanoid.CameraOffset = Vector3.new(0, 0, -1)
	end
end)
1 Like

Which parts, if any, function in the test server?
If you chuck print statements throughout, which, if any, output?
Did you ensure that you have actually published it, and that it is published to the main place rather than another place within the experience.

1 Like

I didn’t have the game published, I didn’t know I need to do that. When i did it and tried again it worked. Thanks for your help

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.