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

Body Color Change with Filtering Enabled?

Asked by 6 years ago
Edited 6 years ago

Hey, guys I am trying to make a GUI so that when you click a TextButton, the player's character's body colors change via the BodyColors object found inside the default character. I have successfully created this without Filtering Enabled turned on. However, being fairly new to developing with Filtering Enabled, I just can't seem to get it working with Filtering Enabled turned on. I would really appreciate it if someone could explain to me what I'm doing wrong. Thanks in advance.

(The hierarchies are correct for all objects below)

--local script (Client)
local replicatedStorage = game:GetService("ReplicatedStorage")
skinToneEvent = replicatedStorage:WaitForChild("SkinToneEvent") -- the remote event
players = game:GetService("Players")
player = players.LocalPlayer
repeat wait() until player.Character
character = player.Character

button1 = script.Parent:WaitForChild("Button1")
b1color = "Pastel brown"

button1.MouseButton1Down:connect(function()
    skinToneEvent:FireServer(b1color)
end)


--server script (Server)
local replicatedStorage = game:GetService("ReplicatedStorage")
skinToneEvent = replicatedStorage:FindFirstChild("SkinToneEvent")

skinToneEvent.OnServerEvent:connect(function(player, color)
    local character = player.Character
    if character then
        local bodyColors = character:FindFirstChild("Body Colors")
        bodyColors.HeadColor = BrickColor.new(color)
        bodyColors.LeftArmColor = BrickColor.new(color)
        bodyColors.RightArmColor = BrickColor.new(color)
    end
end)
1
This looks pretty correct to me, if there are no errors then place prints around the script to see what gets runed and not, its a good way to see if something isn't going through DanzLua 2879 — 6y
0
Lol, I accidentally placed my server script in ServerStorage... Thanks for letting me realize xD dpark19285 375 — 6y
0
;p DanzLua 2879 — 6y

Answer this question