So I made a tool with a GUI Inside It which Is used to keep on track on how many kills you currently have, to get kills you must kill someone with a AK-47, Currently there is a problem where It won't give me kills even If you kill someone with the AK-47, there Is a error that says:
TextLabel Is not a valid member of ScreenGUI "Players.imnotaguest1121 (Thats my username).PlayerGUI.ScreenGUI
Local script (Shows GUI and bugged/glitch give kills):
wait(1)
GUI = script.Parent.ScreenGui
local Player = game.Players.LocalPlayer
local Kills = 1
script.Parent.Equipped:Connect(function()
local GUIClone = GUI:Clone()
GUIClone.Parent = Player.PlayerGui
script.Parent.Unequipped:Connect(function()
GUIClone:Destroy()
end)
script.Parent.GiveKill.OnClientEvent:Connect(function() ---Used a RemoteEvent
Kills = Kills + 1
GUIClone.TextLabel = "Kills: "..Kills
end)
end)
And If you want, the server script: (Look at Line 22):
local tool = script.Parent
local Shoot = tool.Shooting
local PewAnimation = tool.Animation
tool.Fire.OnServerEvent:Connect(function(player,mousePos)
local Humanoid = tool.Parent.Humanoid
local AnimationTrack = Humanoid:LoadAnimation(PewAnimation)
AnimationTrack:Play()
Shoot:Play()
local raycastParams = RaycastParams:new()
raycastParams.FilterDescendantsInstances = {player.Character}
raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
local raycastResault = workspace:Raycast(tool.Handle.Position,(mousePos - tool.Handle.Position)*1000,raycastParams)
if raycastResault then
local hitpart = raycastResault.Instance
local model = hitpart:FindFirstAncestorOfClass("Model")
if model then
if model:FindFirstChild("Humanoid") then
model.Humanoid.Health -= math.random(1,2)
if model.Humanoid.Health <= 1 then
tool.GiveKill:FireClient(player)
end
end
end
end
end)

3 comments
I think the numberline Is 06:28:36.399, I saw the number In outpost
like, which line of code the error came from
it should say "stack begin [line break] script '[the path to the script in question]', Line [the line number]