(HELP NEEDED) Help with shell coloring changing code?

So i have some code that sets values inside of the player to rgb values. one value for each variable “r” “g” “b” and it isn’t working. Please help!

local Players = game:GetService("Players")
local player = Players.LocalPlayer
local Red = game.Players.LocalPlayer:WaitForChild("ShellColor").r.Value
local Green = game.Players.LocalPlayer:WaitForChild("ShellColor").g.Value
local Blue = game.Players.LocalPlayer:WaitForChild("ShellColor").b.Value
local ShellOuter = player.Character:WaitForChild("ShellOuter")
local ShellInner = player.Character:WaitForChild("ShellOuter")
local MarketplaceService = game:GetService("MarketplaceService")


local GAMEPASS_ID = 848500558


local ownsGamepass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, GAMEPASS_ID)
if ownsGamepass == true then
	ShellInner = Color3.fromRGB(Red, Green, Blue)
	ShellOuter = Color3.fromRGB(Red, Green, Blue)
end

This is server script in StarterCharacterScripts

I have a local script inside of a textbox ui (3 of them actually) for each rgb value. idk if these might actually be the problem

local Blue = game.Players.LocalPlayer:WaitForChild("ShellColor").b

script.Parent.Changed:Connect(function()
	Blue.Value = script.Parent.Text
end)
4 Likes

Try changing these two things, and tell me if it works:

  1. Server scripts cannot get the player via game.Players.LocalPlayer. Use game.Players.PlayerAdded to get each individual player instead.
  2. The ShellInner variable is the same as the ShellOuter variable, just a minor bug I saw. (Don’t know if it’s intentional or not.)

Here’s an example if it helps:

local marketPlaceService = game:GetService("MarketplaceService")
local players = game:GetService("Players")

local gamepassID = 848500558

local function changeShellColor(player)
	local red = player:WaitForChild("ShellColor").r.Value
	local green = player:WaitForChild("ShellColor").g.Value
	local blue = player:WaitForChild("ShellColor").b.Value
	
	local character = player.Character or player.CharacterAdded:Wait()
	
	local shellOuter = player.Character:WaitForChild("ShellOuter")
	local shellInner = player.Character:WaitForChild("ShellInner")
	
	local ownsGamepass = marketPlaceService:UserOwnsGamePassAsync(player.UserId, gamepassID)
	
	if ownsGamepass == true then
		shellInner = Color3.fromRGB(red, green, blue)
		shellOuter = Color3.fromRGB(red, green, blue)
	end
end	

players.PlayerAdded:Connect(function(player)
	changeShellColor(player)
end)
1 Like

Still not working, i think the incorrect code might be the textboxes.
image

local Blue = game.Players.LocalPlayer:WaitForChild("ShellColor").b

script.Parent.Changed:Connect(function()
	Blue.Value = script.Parent.Text
end)

image
they are number values

1 Like

Placing a folder in StarterPlayer doesn’t replicate to the player when playing the game. Try putting the ShellColor folder into the server script and then copy this piece of code into the server script:

players.PlayerAdded:Connect(function(player)
    script.ShellColor:Clone.Parent = player

	changeShellColor(player)
end)

Also, just to ensure it’s a number, do this when setting the values of the NumberValue:

script.Parent.Changed:Connect(function()
    local Number =  tonumber(script.Parent.Text)
    
    if Number == nil then return end

	Blue.Value = Number
end)
1 Like

its angry at me about the . when parenting the folder
image

1 Like

Oh sorry, do this instead:

  script.ShellColor:Clone().Parent = player
1 Like

idk… still isn’t working. anything else that i might be doing wrong? or could try? does it help to know that it’s a custom character? i assume you already knew that from where i’m trying to get the shell from

1 Like

Could you please send the entire script with all the modifications?

1 Like
local marketPlaceService = game:GetService("MarketplaceService")
local players = game:GetService("Players")

local gamepassID = 848500558

local function changeShellColor(player)
	local red = player:WaitForChild("ShellColor").r
	local green = player:WaitForChild("ShellColor").g
	local blue = player:WaitForChild("ShellColor").b

	local character = player.Character or player.CharacterAdded:Wait()

	local shellOuter = player.Character:WaitForChild("ShellOuter")
	local shellInner = player.Character:WaitForChild("ShellInner")

	local ownsGamepass = marketPlaceService:UserOwnsGamePassAsync(player.UserId, gamepassID)

	if ownsGamepass == false then
		shellInner = Color3.fromRGB(red, green, blue)
		shellOuter = Color3.fromRGB(red, green, blue)
	end
end	

players.PlayerAdded:Connect(function(player)
	script.ShellColor:Clone().Parent = player

	changeShellColor(player)
end)

local Blue = game.Players.LocalPlayer.b

script.Parent.Changed:Connect(function()
	local Number =  tonumber(script.Parent.Text)

	if Number == nil then return end

	Blue.Value = Number
end)
1 Like
local Blue = game.Players.LocalPlayer:WaitForChild('ShellColor').b

script.Parent.Changed:Connect(function()
	local Number =  tonumber(script.Parent.Text)

	if Number == nil then return end

	Blue.Value = Number
end)

What I changed was the local Blue = game.Players.LocalPlayer.b and changed it to local Blue = game.Players.LocalPlayer:WaitForChild('ShellColor').b since in the code above demonstrates that the numbervalue ‘b’ is inside a folder named ShellColor.

1 Like

still nothin : (

Would making the values not in a folder be better or…?

1 Like

Are there any outputs inside the developer console? If so, could you send an image?

1 Like

No errors except for infinite yields for the waitforchilds

1 Like

Could you send an image?

CHARACTERSSSSSSSSSSSSSSSSSSSSSSSSSSSS

1 Like


I don’t need the folders if they are an issue.

1 Like

Are you sure that the folder is being parented to the Player, are you sure the folder isn’t nil?

1 Like

I don’t know, the first guy added the folder cloning into the player so i’m not sure. let me check

1 Like

No i don’t see the folder when i check the player when i load the game up

1 Like

I’d reckon you should place it in StarterCharacterScripts then attempt to get the folder from the player via player.Character
image

This might be what you were planning however, if it doesn’t work let me know.

1 Like

i don’t quite get it… Could you elaborate?
Thanks

1 Like