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

Making it so all players can see changes to a player's character(FE)?

Asked by 8 years ago

I recently made my game FilteringEnabled. I have a character creation GUI in the beginning of the game when a player joins and it changes the characters face, shirt, pants, etc. Before Filtering, all players could see the changes done (shirts changing, pants changing, etc). But after Filtering, only the localplayer sees the items being changed on his/her character.

01local player = game.Players.LocalPlayer
02local Character = player.Character
03if not Character or not Character.Parent then
04    Character = player.CharacterAdded:wait()
05end
06 
07 
08script.Parent.MouseButton1Down:connect(function()
09    local Head = Character.Head
10    local BodyColors = Character:FindFirstChild("Body Colors")
11    local Shirt = Character:FindFirstChild("Shirt")
12    local Pants = Character:FindFirstChild("Pants")
13    if Shirt then
14        Shirt.ShirtTemplate = "rbxassetid://629730174"
15    else
View all 63 lines...

I'm not sure but I think I would need to use a RemoteEvent and use FireAllClients(). Can someone point me in the right direction?

1 answer

Log in to vote
1
Answered by
TrippyV 314 Donator Moderation Voter
8 years ago

FilteringEnabled can be tricky, but you can't change anything in a LocalScript without it being local. You need to use a server script, RemoteEvents, and FireServer.

Put this in a server script in ServerScriptService:

01local Event = Instance.new("RemoteEvent")
02Event.Name = "ChangeShirt"
03Event.Parent = game.ReplicatedStorage
04 
05local Event2 = Instance.new("RemoteEvent")
06Event2.Name = "ChangePants"
07Event2.Parent = game.ReplicatedStorage
08 
09local Event3 = Instance.new("RemoteEvent")
10Event3.Name = "ChangeBodyColors"
11Event3.Parent = game.ReplicatedStorage
12 
13Event.OnServerEvent:connect(function(plr, id, shirt)
14    if shirt ~= nil then
15        shirt.ShirtTemplate = id
View all 61 lines...

Now this should be your LocalScript:

01local player = game.Players.LocalPlayer
02local Character = player.Character
03if not Character or not Character.Parent then
04    Character = player.CharacterAdded:wait()
05end
06 
07local ChangeShirt = game.ReplicatedStorage:WaitForChild("ChangeShirt")
08local ChangePants = game.ReplicatedStorage:WaitForChild("ChangePants")
09local ChangeColors = game.ReplicatedStorage:WaitForChild("ChangeBodyColors")
10 
11script.Parent.MouseButton1Down:connect(function()
12    local Head = Character.Head
13    local BodyColors = Character:FindFirstChild("Body Colors")
14    local Shirt = Character:FindFirstChild("Shirt")
15    local Pants = Character:FindFirstChild("Pants")
View all 41 lines...

This should all (in theory) work as you want, if anything goes wrong feel free to comment and I'll try to respond as quick as possible.

Ad

Answer this question