Local Scripts being interpreted as Scripts

I keep receiving this error when using play solo.

Here’s the hierarchy incase you need it.

I apologize for not passing on code before.

local camera = game.Workspace.CurrentCamera
local duration = 0.5
local tween = 0
local lastHit = nil

function tweenColor(newColor)
	local currentColor = script.Parent.BackgroundColor3
	local r, g, b = currentColor.r, currentColor.g, currentColor.b
	local newR, newG, newB = newColor.r, newColor.g, newColor.b
	tween = tween + 1
	local tweenNum = tween
	local timer = tick()
	spawn(function ()
		repeat
			local i = (tick()-timer)/duration
			i = i > 1 and 1 or i
			local iR, iG, iB = r + ((newR - r) * i), g + ((newG - g) * i), b + ((newB - b) * i)
			script.Parent.BackgroundColor3 = Color3.new(iR, iG, iB)
			game:GetService'RunService'.RenderStepped:wait()
		until (tick()-timer) >= duration or tweenNum ~= tween
	end)
end

function findFirstPart()
	local ignore = {game.Players.LocalPlayer.Character}
	local start, finish = camera.CoordinateFrame.p, (camera.CoordinateFrame * CFrame.new(0, 0, -1)).p
	local ray = Ray.new(start, (finish-start).unit * 100)
	local hit, pos
	repeat
		hit, pos = game.Workspace:FindPartOnRayWithIgnoreList(ray, ignore)
		table.insert(ignore, hit)
	until hit == nil or hit.Transparency <= 0
	return hit
end

while wait() do
	local hit = findFirstPart()
	if hit and hit ~= lastHit then
		lastHit = hit
		tweenColor(hit.BrickColor.Color)
	end
end
3 Likes

Repro level please?

1 Like

Cant’ confirm.

1 Like

Can you at least post lines 15-30 of the script?

My initial guess is that your LocalScript is calling a RemoteFunction and the server script is trying to use RenderStepped.

1 Like

Server script would actually connect to RenderStepped fine in Play Solo.

If the local script is connecting to RenderStepped while the script is not parented to PlayerGUI etc. (I think this may happen when player respawns) this could happen - so maybe if you’re using RenderStepped:wait() in a loop player respawn breaks it.

2 Likes

Here is the included repro level. (Confidential.)
[confidential][/confidential]

1 Like

Repro steps please? I don’t have an instance with name LocalScript when I do Play Solo.

1 Like

There is a copy, the repro level I have given you I moved the local script into the Gui, that was my mistake.

You’ll find it here.
ScreenGui > Frame > Frame > Frame > Frame > ItemViewer > Title Area

Infact, here is a warning from the core scripts that shows it’s not just the local script having this trouble.

There’s no specific repro steps, and I haven’t messed with any studio settings.

I’ve run into this issue before actually. RunService.RenderStepped works with server sided scripts on the client while in build for whatever the reason.

1 Like

That’s weird, because I know that RunService.RenderStepped actually does work on regular server sided scripts on the client while in build, however not online servers.

1 Like