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

FilteringEnabled & Local Parts?

Basically my game has FilteringEnabled on (have not used this before) and I need to show a model only to the player when they join...

I've come up with this in a local script, inside *StarterPlayerScripts * under StarterPack. It works in normal studio test mode yet when I start a Test Server only the player's name is printed and nothing gets moved....

local player = game.Players.LocalPlayer

if player.Name == "Player1" or player.Name == "Player" then
	print(player.Name)
	local clone = game.ServerStorage.ShipModel:Clone()
	clone.Parent = game.Workspace
	print("Cloned and moved")
end

Any help is appreciated, thanks :)

2 answers

This is because local scripts cannot access game.ServerStorage

For more information on LocalScripts please visit this link.

2 comments

0

Forgot he's putting it in workspace? ._.

0

Doesn't matter, ServerStorage is practically invisible to the LocalScript so it can't "find" the Model in the first place.

So if you want the model to only be viewed by the player them selves. im sure you can do that with FE, but your better off putting it in the players camera by doing the following:

local player = game.Players.LocalPlayer
if player.Name == "Player1" or player.Name == "Player" then
    print(player.Name)
    game.ReplicatedStorage.ShipModel:Clone().Parent = game.Workspace.CurrentCamera
    print("Cloned and moved")
end

You should have used Replicated storage, you used server storage

local clone = game.ServerStorage.ShipModel:Clone()

And camera is a good way to keep things local.

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