something like that buts is RED ERROR i cant stop it its ruining me help if u care
i made a wait but that doesnt work :(
wait(5)
game.Players.LocalPlayer.Chatted:Connect(function(msg, recipient)
local ID = game.ReplicatedStorage.ID:Clone()
if msg == string.lower(":give id") or string.upper(":GIVE ID") then
if recipient then ID.Parent = recipient.Backpack else
ID.Parent = game.Players.LocalPlayer.Backpack
end
end
end)
game.Players.LocalPlayer
is only available through LocalScript
objects. Consider using the game.Players.PlayerAdded
event, doing this server-side, and calling Player:WaitForChild("Backpack")
to get the backpack.
Additionally, just check if the lower form of a message is equal to ":give id", rather than two comparisons, though I recommend using string patterns to split the message into arguments as I did in my older answer, as it's a far more extensible solution.