I want to pass a StringValue to the client from the server to only one client but when I use :FireClient() it returns the string a nil.
Server Script:
for _, SectorDetector in pairs(workspace:GetDescendants()) do
if SectorDetector:IsA("Part") and SectorDetector.Name == "SectorDetector" and SectorDetector.Sector then
SectorDetector.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local plr = game.Players:GetPlayerFromCharacter(hit.Parent:FindFirstChild("Humanoid").Parent)
if plr then
print(plr)
game:GetService("ReplicatedStorage").SectorNotification:FireClient(plr, tostring(SectorDetector.Sector.Value))
end
end
end)
end
end
Client Script:
game:GetService("ReplicatedStorage").SectorNotification.OnClientEvent:Connect(function(plr, sector)
if plr then
script.Parent.TextLabel.Text = "— Entering "..sector.." —"
end
end)
On the Client Script, arugment called “sector” is nil even though it is passed as a string value.