Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Replicated Storage not accessible from server?

On my game, the server-side cant access something a localscript instance.new'ed into it.

3 comments

0

can you post the code

0

What is your main goal exactly?

If you're trying to create a LocalScript and parent it to a player, I would suggest storing the localscripts in Lighting, then once the player joins and the character is added, you clone the localscript into the player's backpack/character.

0

Filtering Enabled is why. Basically if a client makes a change, Filtering makes it NOT replicate to the server. you would want to use Remote Events for that. https://developer.roblox.com/en-us/api-reference/property/Workspace/FilteringEnabled

2 answers

As you mentioned in a comment, the point lite script should be provided.

A simple explanation for why the the Server cannot locate the object in ReplicatedStorage is because the LocalScript only affects the Client's game.

To create an object in the ReplicatedStorage during a game, you need to fire a ServerEvent that creates the part in the ReplicatedStorage.

Here is an article on how to send Client to Server events:

developer.roblox.com/en-us/articles/Remote-Functions-and-Events

I hope this can help.

It sounds like you're creating something on a local script and not understanding why the server can't see it. You would need to use RemoteEvents.

in your local script you would have:

at the beginning of the script:

local RepStorage(game:GetService("ReplicatedStorage")
local PointLightEvent = RepStorage:WaitForChild("PointLightEvent")

when the f key is pressed:

PointLightEvent:FireServer()

in a new server script:

local RepStorage(game:GetService("ReplicatedStorage")
local PointLightEvent = Instance.new("RemoteEvent",RepStorage)
PointLightEvent.Name = "PointLightEvent"

PointLightEvent.OnServerEvent:Connect(function(player)
	local pointlight = (PointLightHere) -- replace (PointLightHere) with wherever your pointlight is, if it is held by a player you would do something like player.Character.Flashlight.Part.PointLight
	pointlight.Enabled = not pointlight.Enabled
end)

This is not great code, but it should fix your problem. If there are any issues, let me know, though I might be going to sleep soon. I also recommend doing a bit of research on RemoteEvents.

This discussion is preserved as it was. New answers, comments, and votes are closed.