Part created on the server not visible on the client for whatever reason

Hi! I’m trying to make an effect on the client, but the part isn’t showing up on the client even thought it was made on the server.

-- Server
local MainLightningEffect = IcedShifting.Resources.Main:Clone()
MainLightningEffect.CFrame = Character.HumanoidRootPart.CFrame
MainLightningEffect.Name = "LightningSparksMain"
MainLightningEffect.Parent = workspace
MainLightningEffect.Shift:Play()
-- extract from the client after firing from the server
local data = {
			
			Time = data.Time,
			Bottom = workspace.LightningSparksMain.Bottom,
			Top = workspace.LightningSparksMain.Top,
			Beam = workspace.LightningSparksMain.Beam,
		}
print(data)

Outputs : LightningSparksMain is not a valid member of Workspace “Workspace” - Client - ShiftClient:43

Even though it’s visible on the client through the explorer?
image

Does anyone know why this is happening? Any help would be appreciated.

3 Likes

The client script might have loaded before the Lightning sparks are created. Try this

-- extract from the client after firing from the server
local lightningsparks = workspace:WaitForChild("LightningSparksMain")
local data = {
			
			Time = data.Time,
			Bottom = lightningsparks.Bottom,
			Top = lightningsparks.Top,
			Beam = lightningsparks.Beam,
		}
print(data)
1 Like

StreamingEnabled is on by default for new experiences iirc. Maybe you’re too far away from the part?

2 Likes

They said that the object is visible on the client through the explorer (while running i assume)
So it couldn’t be that they are far away

1 Like

Make sure to adjust the event or remote function names to match your actual setup.
Re-formatted it a bit … Hope this helps!

Server Script

local MainLightningEffect = IcedShifting.Resources.Main:Clone()
MainLightningEffect.CFrame = Character.HumanoidRootPart.CFrame
MainLightningEffect.Name = "LightningSparksMain"
MainLightningEffect.Parent = workspace
MainLightningEffect.Shift:Play()

local data = {
    Bottom = workspace.LightningSparksMain.Bottom,
    Top = workspace.LightningSparksMain.Top,
    Beam = workspace.LightningSparksMain.Beam,
}

remoteEvent:FireClient(player, data)

Client Script

local function handleLightningEffectData(data)
    local bottom = data.Bottom
    local top = data.Top
    local beam = data.Beam
end

local remoteEvent = game.ReplicatedStorage.LightningEffectEvent
remoteEvent.OnClientEvent:Connect(handleLightningEffectData)

Sorry, I missed a line there …

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