local toClone = game.ReplicatedStorage.PlayerOverhead
local textServ = game:GetService("TextService")
game.Players.PlayerAdded:Connect(function(plr)
local rpData = Instance.new("Folder")
rpData.Name = "RPData"
local rpName = Instance.new("StringValue")
rpName.Name = "RPName"
rpName.Parent = rpData
rpData.Parent = plr
plr.CharacterAdded:Connect(function(char)
local cloned = toClone:Clone()
cloned.Parent = char.Head
if(plr.RPData.RPName.Value ~= "") then
cloned.TextLabel.Text = plr.RPData.RPName.Value
else
cloned.TextLabel.Text = plr.Name
end
end)
plr.RPData.RPName.Changed:Connect(function()
plr.Character.Head.PlayerOverhead.TextLabel.Text = plr.RPData.RPName.Value
end)
end)
game.ReplicatedStorage.ChangeRPName.OnServerEvent:Connect(function(plr, name)
local filteredObject
local filteredText
local success, err = pcall(function()
filteredObject = textServ:FilterStringAsync(name, plr.UserId)
end)
if(success) then
local complete, failed = pcall(function()
filteredText = filteredObject:GetNonChatStringForBroadcastAsync()
end)
if(complete) then
plr.Character.Head.PlayerOverhead.TextLabel.Text = filteredText
end
end
end)
script.Parent.MouseButton1Click:Connect(function()
local text = script.Parent.Parent.TextBox.Text
if(text ~= "") then
print("Firing")
game.ReplicatedStorage.ChangeRPName:FireServer(text)
end
end)
please send a fixed version of what’s being buggy and please tell me what i missed
because i have been trying different things for days and nothing is working the studio version works but the in game version dosent i am just so confused
You have to wait for the Character to be parented to workspace Roblox will auto delete the billboard GUI since the character is still not parented yet when you parented the UI.
You can swap CharacterAdded to CharacterAppearanceLoaded and issue will be solved, or you can wait for it to be in workspace another way though the first method would be perfect.
IT WORKED THANK YOU also I am trying to figure how to remove the filter because i am only making it for my sister and her friends to rp on and the filter will just be an incovience for them and nobody else will be playing it if you could help with that too
I guess I see the point, but still, to be safe make sure you make at least a slight working filter, or who knows if somebody swears. Your account and the person who swore, the accounts might be in danger, so yeah! Good job on finding the issue.
Try changing the code to this, this waits for everything to fully load.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local toClone = ReplicatedStorage:WaitForChild("PlayerOverhead")
local textServ = game:GetService("TextService")
game.Players.PlayerAdded:Connect(function(plr)
local rpData = Instance.new("Folder", plr)
rpData.Name = "RPData"
local rpName = Instance.new("StringValue", rpData)
rpName.Name = "RPName"
plr.CharacterAdded:Connect(function(char)
local cloned = toClone:Clone()
cloned.Parent = char:WaitForChild("Head")
if (plr.RPData.RPName.Value ~= "") then
cloned:WaitForChild("TextLabel").Text = plr.RPData.RPName.Value
else
cloned:WaitForChild("TextLabel").Text = plr.Name
end
end)
plr.RPData.RPName.Changed:Connect(function()
if game.Workspace:FindFirstChild(plr.Name) then
plr.Character:WaitForChild("Head"):WaitForChild("PlayerOverhead"):WaitForChild("TextLabel").Text = plr.RPData.RPName.Value
end
end)
end)
ReplicatedStorage:WaitForChild("ChangeRPName").OnServerEvent:Connect(function(plr, name)
local filteredObject
local filteredText
local success, err = pcall(function()
filteredObject = textServ:FilterStringAsync(name, plr.UserId)
end)
if(success) then
local complete, failed = pcall(function()
filteredText = filteredObject:GetNonChatStringForBroadcastAsync()
end)
if (complete) and game.Workspace:FindFirstChild(plr.Name) then
plr.Character:WaitForChild("Head"):WaitForChild("PlayerOverhead"):WaitForChild("TextLabel").Text = filteredText
end
end
end)