oooooooooooooooooooooh, And yes i added a remote event on ReplicatedStorage
What do you mean?, Add an Remote Event Again?
So i add another RemoteEvent named âKillFeedâ?
It has what youâre looking for
and even chat messages for that too.
Got the same error. i added a RemoteEvent named âKillFeedâ too
nO
Remote event:
Gui:
Workspace: insert a folder on workspace named âKillFeedâ
Script: ServerScriptService
local RemoteEvent = game:GetService("ReplicatedStorage"):WaitForChild("Events", math.huge).Damage
local Killfeed = workspace.KillFeed
RemoteEvent.OnServerEvent:Connect(function(Player, Target, Damage)
local Humanoid = Target:FindFirstChildOfClass("Humanoid")
if Humanoid and Humanoid.Health > 0 then
Humanoid:TakeDamage(Damage)
if Humanoid.Health <= 0 then
local Folder = Instance.new("Folder")
Folder.Name = #Killfeed:GetChildren()
Folder.Parent = Killfeed
local Killer = Instance.new("StringValue")
Killer.Name = "Killer"
Killer.Value = Player.Name
Killer.Parent = Folder
local Killed = Instance.new("StringValue")
Killed.Name = "Killed"
Killed.Value = Target.Name
Killed.Parent = Folder
Debris:AddItem(Folder, 5)
end
end
end)
LocalScript: ScreenGui
local KillFeed = workspace.KillFeed
local Feeds = script.Parent.Feeds
local function RefreshFeed() task.wait()
for i, OldFeed in pairs(Feeds:GetChildren()) do
if OldFeed:IsA("TextLabel") then
OldFeed:Destroy()
end
end
for i, Feed in pairs(KillFeed:GetChildren()) do
local Template = script.Parent.Template:Clone()
Template.Text = Feed.Killer.Value .. " has killed " .. Feed.Killed.Value
Template.Parent = Feeds
Template.Visible = true
end
end
KillFeed.ChildAdded:Connect(RefreshFeed)
KillFeed.ChildRemoved:Connect(RefreshFeed)
And by the way, Any of you mind helping me with this??
Automatically Equips a Pistol when joined!
-- Place inside StarterPlayerScripts
--// Custom system INTEGRATED with default Roblox Tools //--
local Players = game:GetService("Players")
local StarterGui = game:GetService("StarterGui")
local UserInputService = game:GetService("UserInputService")
local Player = Players.LocalPlayer
local Tools = {}
local Keybinds = {
[Enum.KeyCode.One] = 1,
[Enum.KeyCode.Two] = 2,
[Enum.KeyCode.Three] = 3,
[Enum.KeyCode.Four] = 4,
[Enum.KeyCode.Five] = 5,
[Enum.KeyCode.Six] = 6,
[Enum.KeyCode.Seven] = 7,
[Enum.KeyCode.Eight] = 8,
[Enum.KeyCode.Nine] = 9,
[Enum.KeyCode.Zero] = 10,
}
--// Initializer //--
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
--// Input Handler //--
UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
if gameProcessedEvent then
return
end
if Player.Character == nil then
return
end
local humanoid = Player.Character:FindFirstChild("Humanoid")
if humanoid == nil then
return
end
-- Handles 0-9 keycodes
if input.UserInputType == Enum.UserInputType.Keyboard then
if Keybinds[input.KeyCode] then
local slot = Keybinds[input.KeyCode]
local existingTool = Player.Character:FindFirstChildOfClass("Tool")
if existingTool then
if Tools[slot] == existingTool then
humanoid:UnequipTools()
else
if Tools[slot] then
humanoid:EquipTool(Tools[slot])
end
end
else
if Tools[slot] then
humanoid:EquipTool(Tools[slot])
end
end
end
end
end)
UserInputService.InputChanged:Connect(function(input, gameProcessedEvent)
if gameProcessedEvent then
return
end
if Player.Character == nil then
return
end
local humanoid = Player.Character:FindFirstChild("Humanoid")
if humanoid == nil then
return
end
-- Handles mouse wheel
if input.UserInputType == Enum.UserInputType.MouseWheel then
local direction = input.Position.Z > 0 and 1 or -1
local existingTool = Player.Character:FindFirstChildOfClass("Tool")
if existingTool then
local toolSlot = table.find(Tools, existingTool)
if toolSlot then
local toSlot = toolSlot + direction
if toSlot < 1 then
toSlot = #Tools
elseif toSlot > #Tools then
toSlot = 1
end
humanoid:EquipTool(Tools[toSlot])
end
end
end
end)
--// Tools Handler //--
local function AddToolToList(tool)
if tool:IsA("Tool") then
if not table.find(Tools, tool) then
table.insert(Tools, tool)
end
end
end
local function RemoveToolFromList(tool)
if tool:IsA("Tool") then
if tool.Parent ~= Player.Character then -- Check if tool has been forcefully removed
local toolIndex = table.find(Tools, tool)
if toolIndex then
table.remove(Tools, toolIndex)
end
end
end
end
Player.ChildAdded:Connect(function(backpack)
if backpack:IsA("Backpack") then
local character = Player.Character or Player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid", 5)
if humanoid then
-- In case any new tools gets added
local addedConnection = backpack.ChildAdded:Connect(function(tool)
AddToolToList(tool)
end)
-- In case any new tools gets destroyed
local removedConnection = backpack.ChildRemoved:Connect(function(tool)
RemoveToolFromList(tool)
end)
-- Add already-existing tools
for _, tool in ipairs(backpack:GetChildren()) do
AddToolToList(tool)
end
-- Clear upon death
local deadConnection
deadConnection = humanoid.Died:Connect(function()
addedConnection:Disconnect()
removedConnection:Disconnect()
deadConnection:Disconnect()
Tools = {}
end)
end
end
end)
Itâs a Script, The HotBar is Invisible but you can still Equip Items. But i want it to automatically equip a Pistol when you join. Credits to the owner of the Script!
Yeah. This script is strange. It has components of both a local script and a server script. But whatâs missing is something to get the content from the server to the player. GUIs are client side, but the server holds the information. You need a remote event to get the data from the server.
So what does that mean? The point is like to add a uhmâŚAutomatic Equip for the Pistol
Well, to automatically equip a tool (A pistol is considered a tool), you would place the tool in the StarterPack.
I got looking at it again, billboard GUIs are surface GUIs which have a part as a parent (I think). Iâm not sure thatâs what you are looking for. You will need to use a ScreenGui with a frame and some kind of label to display information to each player, then you setup a remote event so the server can fire all clients with the information so itâs displayed to each player.
No i meant, A Automatic Equip like arsenal, Like if you join. You will automatically given a gun
In a case like that, you clone the tool and parent the clone to the playerâs character. That will equip it on the character.
Can you send me a screenshot on where to put?
Can i do it without making the Hotbar Visible?
Literally the worst way you could do damage⌠Literally, this is all an exploiter needs to do to kill everyone. while wait() do fireremote() end and boom everyone is deadâŚ
Hereâs some code for you (Server Side):
local serverStorage = game:GetService("ServerStorage")
local weaponsCache = serverStorage:FindFirstChild("Weapons")
-- Equip a weapon onto a player.
local function equipWeapon(player, weaponName)
local weapon = weaponsCache:FindFirstChild(weaponName)
if weapon == nil then
warn("Invalid weapon name.")
return
end
local playerWeapon = weapon:Clone()
playerWeapon.Parent = player.Character
end
-- Removes an equipped weapon.
local function removeWeapon(player)
local char = player.Character
local weapon = char:FindFirstChildOfClass("Tool")
if weapon == nil then
warn("Player does not have any weapons equipped.")
return
end
weapon:Destroy()
end
Thatâs a programmable way to equip and remove weapons to/from players. So if you want to equip all players with the same weapon, such as an M16-A3 Assault Rifle that is named âM16A3_AssaultRifleâ then you do this:
local playerService = game:GetService("Players")
local weaponName = "M16A3_AssaultRifle"
for _, player in pairs(playerService:GetPlayers())
equipWeapon(player, weaponName)
end
And thatâs it. Remember, when the game is running, the player instance for all players is under game.Players when you look at Explorer in Studio, and the Character (the playerâs model, avatar, etcâŚ) will be under game.Workspace for rendering purposes. Alternatively, instead of destroying a weapon, you can set the parent of weapon
to player.Backpack
and the weapon will go into their inventory.
No kidding. The parameters are an exploiterâs dream because the server side event allows the CLIENT to specify the target and the damage to the target.
fireserver(target,math.huge()) and boom
So i put A Folder in ServerStorage named âWeaponsâ and add a script in ServerScriptSerivce which is this one:
local serverStorage = game:GetService("ServerStorage")
local weaponsCache = serverStorage:FindFirstChild("Weapons")
-- Equip a weapon onto a player.
local function equipWeapon(player, weaponName)
local weapon = weaponsCache:FindFirstChild(weaponName)
if weapon == nil then
warn("Invalid weapon name.")
return
end
local playerWeapon = weapon:Clone()
playerWeapon.Parent = player.Character
end
-- Removes an equipped weapon.
local function removeWeapon(player)
local char = player.Character
local weapon = char:FindFirstChildOfClass("Tool")
if weapon == nil then
warn("Player does not have any weapons equipped.")
return
end
weapon:Destroy()
end
And where do i put this code?:
local playerService = game:GetService("Players")
local weaponName = "M16A3_AssaultRifle"
for _, player in pairs(playerService:GetPlayers())
equipWeapon(player, weaponName)
end
Anybody know how to make a Controller Support for the game?
I tried testing it with a Controller, Everything works just fine. Itâs just the Aiming, It wonât Look Left/Right/Backwards, It only looks straight.
Do you know how?