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

My local part is not client-sided, how can I fix it?

Asked by 5 years ago
Edited 5 years ago

Hello, I have been trying for ages to try and get this single not-so-local part to function properly. I am trying to make it so when a player touches a part, it will load a local part. That works fine, but the part is not quite local, everybody can see it.

Please tell me what is wrong with this local script and why it isn't loading on the client side but on the server side.

local localpart = game.Lighting.Part

game.Workspace.PartLoaderBrick.Touched:connect(function()
    localpart.Parent = game.Workspace.CurrentCamera
end)

Every object should be in the right directory.

The local part is in Lighting, The local script is in Starter GUI, The part loader brick is in the Workspace, and filtering enabled is on for the game.

Thanks for any help you might offer.

2 answers

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

remove the current camera in the parent part of the script also u need to connect the touched function and to do that u type

game.Workspace.PartLoaderBrick.Touched:connect(function(hit)

if hit.parent:FindFirstChild("Humanoid") then--when u walk on the part if will change the parent of the part inside lighting to the workspace for ur eyes only

localpart.Parent = game.Workspace

end

end)
0
I did what you said Gameplayer but it isn't working, it is the exact same. glisterr 0 — 5y
0
use local script. only you can see the part Loominatrx 0 — 5y
0
then the last thing i can think off is making it just visible can cancollide Gameplayer365247v2 1055 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

You can clone parts on the client, you know. Clones of instances that are made on the client are going to be local.

So, here's the fix:

local localpart = game:GetService("Lighting"):WaitForChild("Part")
workspace.PartLoaderBrick.Touched:Connect(function(hit)
    local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
    if player then
        localpart:Clone().Parent = workspace -- The clone should be local
    end
end)

Answer this question