#anyone know why the characters name doesnt disapear after a player leaves
28 messages · Page 1 of 1 (latest)
What's wrong?
when someone leaves the game there name doesnt get deleted
it did before idk what i changed
**try this maybe idk? **
local shift = Enum.KeyCode.LeftShift
local UserInputService = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local UIS = UserInputService
local function walkSpeed(speed: number)
local Character = player.Character
if not Character then
return
end
local Humanoid = Character:FindFirstChildOfClass("Humanoid")
if not Humanoid then
return
end
Humanoid.WalkSpeed = speed
end
UIS.InputBegan:Connect(function(input, isProcessed)
if input.KeyCode == shift and not isProcessed then
walkSpeed(22)
end
end)
UIS.InputEnded:Connect(function(input, isProcessed)
if input.KeyCode == shift and not isProcessed then
walkSpeed(16)
end
end)
whatd you change
Check for isProcessed: Added checks to isProcessed to ensure that the input has not been processed by other actions before changing the walk speed. This avoids conflicts with other input-related scripts or UI interactions.
Removed Extra Code Block: Removed the redundant code block inside UIS.InputEnded:Connect that was checking for the shift key again. it might fix it but idk
local Players = game:GetService("Players")
local name_box = script.Parent.PlayerList.Frame.ScrollingFrame.names
local function createNewText(Player)
local newText = name_box:Clone()
newText.Text = Player.Name
newText.Name = Player.Name.."Frame"
newText.Parent = script.Parent.PlayerList.Frame.ScrollingFrame
end
local function deleteText(Player)
local TextName = Player.Name.."Frame"
local Text = name_box.Parent.ScrollingFrame:FindFirstChild(TextName)
if Text then
Text:Destroy()
end
end
for _, player in ipairs(Players:GetPlayers()) do
createNewText(player)
end
Players.PlayerAdded:Connect(function(player)
createNewText(player)
end)
Players.PlayerRemoving:Connect(function(player)
deleteText(player)
end)```
local Players = game:GetService("Players")
local name_box = script.Parent.PlayerList.Frame.ScrollingFrame.names
-- Create new text entry for a player
local function createNewText(Player)
local newText = name_box:Clone()
newText.Text = Player.Name
newText.Name = Player.Name.."Frame"
-- Ensure the newText is a unique child of ScrollingFrame
newText.Parent = script.Parent.PlayerList.Frame.ScrollingFrame
end
-- Delete text entry for a player
local function deleteText(Player)
local TextName = Player.Name.."Frame"
local Text = script.Parent.PlayerList.Frame.ScrollingFrame:FindFirstChild(TextName)
if Text then
Text:Destroy()
end
end
-- Initialize player list on start
for _, player in ipairs(Players:GetPlayers()) do
createNewText(player)
end
-- Handle new players joining
Players.PlayerAdded:Connect(function(player)
createNewText(player)
end)
-- Handle players leaving
Players.PlayerRemoving:Connect(function(player)
deleteText(player)
end)
Fixes I Made
- Ensure that the
name_boxhas theTextproperty and other relevant settings correctly configured before cloning it. - If you experience performance issues with many players, think about using a more efficient method for updating the UI.
50/50 but i fixed some things that looked wrong had chatgpt check if what i changed was right so yeah i did.
But if you don't know whats wrong use chatgpt ig it is useful to some degree
that's you.
but hey
in my opinion i dont see it as cheating but more like helping
i feel like it is because use that as "help" will lead to you pasting that script in and not even knowing how it works
thats why i ask acutal peopel
cause they can explan on a non ai level
well it explains what it fixes xd