Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Replicated Storage not accessible from server?

Asked by 4 years ago

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

0
can you post the code awesomemode14 68 — 4y
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. astronit 20 — 4y
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 mybituploads 304 — 4y

2 answers

Log in to vote
0
Answered by
BloxRoxe 109
4 years ago
Edited 4 years ago

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.

Ad
Log in to vote
0
Answered by 4 years ago

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.

Answer this question