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?
Does anyone know why this is happening? Any help would be appreciated.
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)
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)