I have been trying to figure this out for the past 24 hours and I have nearly almost given up, like theres nothing more I can do by my self at this point so im coming to the devforum as my last resort. My issue is data in a table is being replicated to everyone and I don’t know why. This is a simple Name system with bio and for some reason when someone save their own Name and Bio, it saves it to everyone else. I have tried to debug it and it seems to be happening somewhere around the function called “ReturningData”, but even then I still don’t have a clue why. I tested this in the built in server game thing in roblox studio and also in game, it showed the same results.
Heres a representation in picture of the problem
Player 1 Changes their Name or Bio:
Player1 views Player2 Profile, and find out they have the same Name and Bio:
Player2 goes to changer their name and Bio and finds out their Name and Bio were already set for some reason:
A few new players joins in right after all this happens and the same issue occurs:
Here is the Code For the Local Script:
--[[Config]]--
Config = {
["Start"] = 0,
["End"] = 1-0.00625,
["Incre"] = .00625
}
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local RS = game:GetService("ReplicatedStorage")
local TextFiltering = RS:WaitForChild("TextFiltering")
local ReturnColorData = RS:WaitForChild("ReturnColorData")
local GetOtherData = RS:WaitForChild("GetOtherData")
local Player = Players.LocalPlayer
local Mouse = Player:GetMouse()
local Icon = script.Parent:WaitForChild("Icon")
local System = script.Parent:WaitForChild("System")
local ViewProfilePrompt = script.Parent:WaitForChild("ViewProfilePrompt")
local ViewProfile = script.Parent:WaitForChild("ViewProfile")
local ProfTitle = ViewProfile:WaitForChild("Title")
local bop = ViewProfile:WaitForChild("Exit")
local Exit = bop:WaitForChild("TextButton")
local ProfZone = ViewProfile:WaitForChild("Zone")
local ProfBioInput = ProfZone:WaitForChild("BioInput")
local ProfBioText = ProfBioInput:WaitForChild("BioText")
local ProfNameInput = ProfZone:WaitForChild("NameInput")
local NameText = ProfNameInput:WaitForChild("NameText")
local Picture = ProfZone:WaitForChild("Picture")
local Userpic = Picture:WaitForChild("Userpic")
local Zone = System:WaitForChild("Zone")
local NameInput = Zone:WaitForChild("NameInput")
local Textbox = NameInput:WaitForChild("TextBox")
local BioInput = Zone:WaitForChild("BioInput")
local BioText = BioInput:WaitForChild("BioText")
local ZColor = Zone:WaitForChild("Color")
local PreviewColor = Zone:WaitForChild("PreviewColor")
local ChosenColor = Zone:WaitForChild("ChosenColor")
local ZShade = Zone:WaitForChild("Shade")
local Viewing = false
local Closed = true
local Held = false
local Debounce = false
local Data = nil
function FormColors()
for i =Config.Start,Config.End,Config.Incre do
local NewColor = Instance.new("TextButton")
NewColor.ZIndex = 5
NewColor.Text = ""
NewColor.BorderSizePixel = 0
NewColor.BackgroundColor3 = Color3.fromHSV(i,1,1)
NewColor.Size = UDim2.new(Config.Incre,0,1,0)
NewColor.Position = UDim2.new(i,0,0,0)
NewColor.Parent = ZColor
NewColor.Name = i
end
for i,v in pairs(ZColor:GetChildren()) do
v.MouseButton1Down:Connect(function()
Held = true
end)
v.MouseButton1Up:Connect(function()
Data = ReturnColorData:InvokeServer(v.BackgroundColor3,nil,nil)
ChosenColor.BackgroundColor3 = v.BackgroundColor3
Textbox.PlaceholderColor3 = Data.Color
Held = false
end)
v.MouseEnter:Connect(function()
if Held then
PreviewColor.BackgroundColor3 = v.BackgroundColor3
for i,v in pairs(ZShade:GetChildren()) do
v:Destroy()
end
for t =Config.Start,Config.End,Config.Incre*10 do
local NewColor = Instance.new("TextButton")
NewColor.ZIndex = 5
NewColor.Text = ""
NewColor.BorderSizePixel = 0
NewColor.BackgroundColor3 = Color3.fromHSV(v.Name,1,t)
NewColor.Size = UDim2.new(Config.Incre*10,0,1,0)
NewColor.Position = UDim2.new(t,0,0,0)
NewColor.Parent = ZShade
NewColor.Name = v.Name
for i,v in pairs(ZShade:GetChildren()) do
v.MouseButton1Down:Connect(function()
Held = true
end)
v.MouseButton1Up:Connect(function()
Data = ReturnColorData:InvokeServer(v.BackgroundColor3,nil,nil)
ChosenColor.BackgroundColor3 = v.BackgroundColor3
Textbox.PlaceholderColor3 = Data.Color
Held = false
end)
v.MouseEnter:Connect(function()
if Held then
PreviewColor.BackgroundColor3 = v.BackgroundColor3
end
end)
end
end
end
end)
end
end
Textbox.Focused:Connect(function()
NameInput.ImageColor3 = Color3.fromRGB(115, 88, 89)
end)
Textbox.FocusLost:Connect(function(enterPressed)
NameInput.ImageColor3 = Color3.fromRGB(115, 115, 115)
if enterPressed then
local FilteredText = TextFiltering:InvokeServer(Textbox.Text)
if FilteredText == nil then
Textbox.Text = ""
else
Textbox.Text = ""
Textbox.PlaceholderText = FilteredText
Data = ReturnColorData:InvokeServer(nil,FilteredText,nil)
end
end
end)
BioText.Focused:Connect(function()
BioInput.ImageColor3 = Color3.fromRGB(115, 88, 89)
end)
BioText.FocusLost:Connect(function(enterPressed)
BioInput.ImageColor3 = Color3.fromRGB(115, 115, 115)
if enterPressed then
local FilteredText = TextFiltering:InvokeServer(BioText.Text)
if FilteredText == nil then
BioText.Text = ""
else
BioText.Text = ""
BioText.PlaceholderText = FilteredText
Data = ReturnColorData:InvokeServer(nil,nil,FilteredText)
end
end
end)
function OnIconClick()
if Closed == true then
Closed = false
FormColors()
Data = ReturnColorData:InvokeServer()
if Data ~= nil then
ChosenColor.BackgroundColor3 = Data.Color
Textbox.PlaceholderColor3 = Data.Color
if Data.Bio ~= nil then
BioText.Text = ""
BioText.PlaceholderText = Data.Bio
else
BioText.Text = ""
BioText.PlaceholderText = "N/A"
end
if Data.Namey ~= nil then
Textbox.Text = ""
Textbox.PlaceholderText = Data.Namey
else
Textbox.Text = ""
Textbox.PlaceholderText = "N/A"
end
end
System:TweenPosition(UDim2.new(0.5, 0, 0.5, 0), nil, nil, .5)
if Viewing == true then
ViewProfile:TweenPosition(UDim2.new(-.5, 0, 0.5, 0), nil, nil, .5)
Viewing = false
end
elseif Closed == false then
Closed = true
System:TweenPosition(UDim2.new(-.5, 0, 0.5, 0), nil, nil, .5)
PreviewColor.BackgroundColor3 = Color3.fromRGB(255,255,255)
for i,v in pairs(ZColor:GetChildren()) do
v:Destroy()
end
for i,v in pairs(ZShade:GetChildren()) do
v:Destroy()
end
end
end
Mouse.Button1Up:Connect(function()
if ViewedPlayer ~= nil and ViewedPlayer ~= Player then
ProfTitle.Text = (ViewedPlayer.Name).."'s Profile"
ViewProfile:TweenPosition(UDim2.new(.5, 0, 0.5, 0), nil, nil, .5)
Userpic.Image = ("http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&username=%s"):format(ViewedPlayer.Name)
if Closed == false then
System:TweenPosition(UDim2.new(-.5, 0, 0.5, 0), nil, nil, .5)
Closed = true
end
Viewing = true
local Other = GetOtherData:InvokeServer(ViewedPlayer)
if Other.Bio ~= nil then
ProfBioText.Text = Other.Bio
else
ProfBioText.Text = "N/A"
end
if Other.Namey ~= nil then
NameText.Text = Other.Namey
else
NameText.Text = "N/A"
end
if Other.Color ~= nil then
NameText.TextColor3 = Other.Color
else
NameText.TextColor3 = Color3.fromRGB(16,16,16)
end
end
end)
Exit.MouseButton1Click:Connect(function()
ViewProfile:TweenPosition(UDim2.new(-.5, 0, 0.5, 0), nil, nil, .5)
Viewing = false
end)
local FindTargets = coroutine.wrap(function()
while wait() do
local Found = false
for i,v in pairs(Player.Character:GetChildren()) do
if v:IsA("Tool") then
Found = true
end
end
if Found == false then
ViewedPlayer = nil
if Mouse.Target then
if Mouse.Target.Parent:IsA("Accessory") then
ViewedPlayer = Players:GetPlayerFromCharacter(Mouse.Target.Parent.Parent)
if ViewedPlayer == nil then
ViewedPlayer = Players:GetPlayerFromCharacter(Mouse.Target.Parent)
end
end
if ViewedPlayer and Viewing == false then
ViewProfilePrompt.Position = UDim2.new(.01,Mouse.X,0,Mouse.Y)
ViewProfilePrompt.Visible = true
else
ViewProfilePrompt.Visible = false
ViewedPlayer = nil
end
else
ViewedPlayer = nil
end
else
ViewProfilePrompt.Visible = false
end
end
end)
FindTargets()
Icon.MouseButton1Click:Connect(OnIconClick)
Here is the Server script:
local Players = game:GetService("Players")
local RS = game:GetService("ReplicatedStorage")
local ReturnColorData = RS:WaitForChild("ReturnColorData")
local GetOtherData = RS:WaitForChild("GetOtherData")
local TextFiltering = RS:WaitForChild("TextFiltering")
local TextService = game:GetService("TextService")
PlayerData = {}
Default = {
Color = Color3.fromRGB(16, 16, 16),
Namey = nil,
Bio = nil
}
local function CreateOverheadOrEdit(Player)
local Character = Player.Character
if Character then
local Head = Character:FindFirstChild("Head")
if Head then
if Character:FindFirstChild("OverHead") then
Character.OverHead.TextLabel.TextColor3 = PlayerData[Player.Name].Color
if PlayerData[Player.Name].Namey ~= nil then
Character.OverHead.TextLabel.Text = PlayerData[Player.Name].Namey
else
Character.OverHead.TextLabel.Text = Player.Name
end
else
local OH = script.OverHead:Clone()
OH.Parent = Character
OH.TextLabel.TextColor3 = PlayerData[Player.Name].Color
if PlayerData[Player.Name].Namey ~= nil then
OH.TextLabel.Text = PlayerData[Player.Name].Namey
else
OH.TextLabel.Text = Player.Name
end
OH.Adornee = Head
end
end
end
end
Players.PlayerAdded:Connect(function(Player)
PlayerData[Player.Name] = Default
Player.CharacterAdded:Connect(function(Character)
local Humanoid = Character:FindFirstChild("Humanoid")
Humanoid.DisplayDistanceType = "Subject"
Humanoid.NameDisplayDistance = 0
CreateOverheadOrEdit(Player)
end)
end)
Players.PlayerRemoving:Connect(function(Player)
PlayerData[Player.Name] = nil
end)
local function ReturningData(Player,NewColor,NewName,NewBio)
if NewColor ~= nil then
PlayerData[Player.Name].Color = NewColor
end
if NewName ~= nil then
PlayerData[Player.Name].Namey = NewName
end
if NewBio ~= nil then
PlayerData[Player.Name].Bio = NewBio
end
CreateOverheadOrEdit(Player)
return PlayerData[Player.Name]
end
local function ReturnFilteredText(Player,Text)
local filteredTextResult
local success, errorMessage = pcall(function()
filteredTextResult = TextService:FilterStringAsync(Text, Player.UserId)
filteredTextResult = filteredTextResult:GetNonChatStringForBroadcastAsync()
end)
if success then
return filteredTextResult
else
warn("Error filtering text:", Text, ":", errorMessage)
return nil
end
end
local function ReturnOtherData(Player,Other)
print(PlayerData[Other.Name].Namey)
print(PlayerData[Other.Name].Bio)
return PlayerData[Other.Name]
end
ReturnColorData.OnServerInvoke = ReturningData
TextFiltering.OnServerInvoke = ReturnFilteredText
GetOtherData.OnServerInvoke = ReturnOtherData
Here is what the explorer looks like:
So basically the most recent thing data replicates to everyone else in the server, and I just now found out via the roblox studio server feature that new players for example Player 3 and so on also get those same data as soon as the enter the server. Please I know the solution isn’t all that far from you guys, I literally don’t know what to do anymore. Please assist me. I need it so everyone keep their own respected data and I don’t know why everyone is merging. Any help is appreciated.