I have a local script inside of a surface gui, inside of the starter gui.
Here's the local script:
local Players = game:GetService("Players") local player = Players.LocalPlayer local playerGui = player:WaitForChild("PlayerGui") local skinsPanel = playerGui:WaitForChild("SkinsPanel").Frame local purpleSand = skinsPanel:FindFirstChild("PurpleSand") local skinColorEvent = game.ReplicatedStorage:WaitForChild("SkinColorEvent") function onPurpleSand() local colorName = Instance.new("StringValue") colorName.Value = "PurpleSand" colorName.Parent = player.Backpack skinColorEvent:FireServer(player,colorName) end purpleSand.Activated:Connect(onPurpleSand)
Inside server script storage is the following script:
local skinColorEvent = Instance.new("RemoteEvent") skinColorEvent.Parent = game.ReplicatedStorage skinColorEvent.Name = "SkinColorEvent" skinColorEvent.OnServerEvent:Connect(function(player,colorName) local character = player.Character local backpack = character:FindFirstChild("Container") local colorPart = backpack:FindFirstChild("Handle") local skinFolder = game.ReplicatedStorage:WaitForChild("Skins") print(colorName.Value) local skin = skinFolder:FindFirstChild(colorName.Value).Texture.Texture end)
However, when skinColorEvent function is called, the server script is reading both arguments as player.
player = player1
colorName = player1
Why is my remote function not carrying the string value that I assign to it in the local script?
When firing servers from the client, you do not need to fire the "player" part, only your variables.
It would instead be this:
local Players = game:GetService("Players") local player = Players.LocalPlayer local playerGui = player:WaitForChild("PlayerGui") local skinsPanel = playerGui:WaitForChild("SkinsPanel").Frame local purpleSand = skinsPanel:FindFirstChild("PurpleSand") local skinColorEvent = game.ReplicatedStorage:WaitForChild("SkinColorEvent") function onPurpleSand() local colorName = Instance.new("StringValue") colorName.Value = "PurpleSand" colorName.Parent = player.Backpack skinColorEvent:FireServer(colorName)--This is where the error was end purpleSand.Activated:Connect(onPurpleSand)