generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Killfeed Script firing on respawn, not death.

Previous Thread :: Next Thread 
frriend is not online. frriend
Joined: 07 Feb 2010
Total Posts: 577
21 Jul 2016 11:36 AM
This is a huge problem because the killfeed script fires a function that fades the players screen out. The problem is it's not firing when they die, but when they respawn. Therefor, causing the black screen to apear late which obstructs the players vision. I cant find the problem, any suggestions?

P.S. the suicides, mysterious deaths, ect work fine. Its only the player killed player

CODE:

function removeStam(plr)
plr.PlayerGui.Stamina.Main.active.Value = false
end

-- REMOTE --

local MAX_MESSAGES = 3
local messageData = setmetatable({}, {__mode='k'})

local function storeMessage(message)
if game.Workspace.Values.GameInProgress.Value == true then
local tick = game.ReplicatedStorage.Sounds.killfeed_tk:Clone()
tick.Parent = game.Workspace
tick:Play()
end
for _, player in pairs(game.Players:GetPlayers()) do
local filteredMessage = message
local playerMessages = messageData[player]
table.insert(playerMessages, filteredMessage)
if #playerMessages > MAX_MESSAGES then
table.remove(playerMessages, 1)
end
print(message)
game.ReplicatedStorage.SendFeed:FireClient(player, playerMessages)
end
end

game.Players.PlayerAdded:connect(function(plr)
-- setup table to hold messages for the player
local playerMessages = {}
messageData[plr] = playerMessages

end)

-- Gamepoints --
function givePoints(player, points)
local PointsService = game:GetService("PointsService")
PointsService:AwardPoints(player.userId, points)
end

-- Feed --

function feed(info)
storeMessage(info)
end

_G.killfeed = function(txt)
feed(txt)
end

-- Tint --

function inform(player, type, desc, tint)
wait(.5)
local gui = player.PlayerGui.KillInform

gui.Kill.Text = type
gui.Desc.Text = desc
gui.Kill.TextTransparency = 1
gui.Desc.TextTransparency = 1

while gui.Kill.TextTransparency >= 0 do
wait(.01)
gui.Kill.TextTransparency = gui.Kill.TextTransparency - .1
end
wait(.5)

while gui.Desc.TextTransparency >= 0 do
wait(.01)
gui.Desc.TextTransparency = gui.Desc.TextTransparency - .1
end

wait(1.5)

if tint then
tint = player.PlayerGui.KillInform.Tint

tint.BackgroundTransparency = 1

for i=1,25 do
wait(.005)
tint.BackgroundTransparency = tint.BackgroundTransparency - .05
gui.Kill.TextTransparency = gui.Kill.TextTransparency + .05
gui.Desc.TextTransparency = gui.Desc.TextTransparency + .05
end
end

if tint == false then

while gui.Kill.TextTransparency <= 1 do
wait(.01)
gui.Kill.TextTransparency = gui.Kill.TextTransparency + .1
gui.Desc.TextTransparency = gui.Desc.TextTransparency + .1

end

gui.Kill.TextTransparency = 1
gui.Desc.TextTransparency = 1

end

end



-- KILL FEED --
game.Players.PlayerAdded:connect(function(plr) -- Gets Player
plr.CharacterAdded:connect(function(char) -- Gets Character
local hum = char.Humanoid
hum.Died:connect(function() -- Checks if humanoid has died.
local creator = hum:FindFirstChild("creator")
if creator then -- // MAIN CODE // --
if game.Workspace.Values.GameInProgress.Value == true then

for _, player in ipairs(game.Players:GetPlayers()) do
for _, gui in ipairs(player.PlayerGui.Killfeed.Holder:GetChildren()) do
if gui.Name == "feed" then
gui:Destroy()
end
end
end

killer = creator.Value
victim = plr

print("[Killfeed] " .. killer.Name.." has killed "..plr.Name.."")

local plrds = game.Players:FindFirstChild(victim.Name)
local plrks = game.Players:FindFirstChild(killer.Name)

if plrds then
plrds.Game_Values.Player_Deaths.Value = plrds.Game_Values.Player_Deaths.Value + 1
plrds.Game_Values.Player_Streak.Value = 0
end
if game.Players:FindFirstChild(killer.Name) then
if killer.Name ~= victim.Name and killer.TeamColor ~= victim.TeamColor then
plrks.Game_Values.Player_Kills.Value = plrks.Game_Values.Player_Kills.Value + 1
credits = math.random(3)
plrks.Game_Values.Player_Credits.Value = plrks.Game_Values.Player_Credits.Value + credits
plrks.Game_Values.Player_XP.Value = plrks.Game_Values.Player_XP.Value + 1

givePoints(killer, math.random(1,2))

if game.Workspace.Values.Events.DoublePoints.Value == true then
plrks.Game_Values.Player_Credits.Value = plrks.Game_Values.Player_Credits.Value + credits
plrks.Game_Values.Player_XP.Value = plrks.Game_Values.Player_XP.Value + 1
end

plrks.Game_Values.Player_Streak.Value = plrks.Game_Values.Player_Streak.Value + 1
end

if killer.Name ~= victim.Name and killer.TeamColor ~= victim.TeamColor and game.Workspace.Values.Gamemode.Value == "Team Deathmatch" then
if killer.TeamColor == BrickColor.new("Bright blue") then
workspace.Score.Blue.Value = workspace.Score.Blue.Value + 1
end

if killer.TeamColor == BrickColor.new("Bright red") then
workspace.Score.Red.Value = workspace.Score.Red.Value + 1
end
end

end

local running = false
for _, player in ipairs(game.Players:GetPlayers()) do

local function cycleFeed() -- Thread One
running = true

if game.Workspace.Data.Bounty.Value ~= nil then
if victim.Name ~= killer.Name and victim.TeamColor ~= killer.TeamColor then
if victim.Name == game.Workspace.Data.Bounty.Value.Name then
for _, player in ipairs(game.Players:GetPlayers()) do
spawn(function() _G.alert("-[ Random Event Complete ]-", killer.Name .. " has Claimed " .. victim.Name .. "'s Bounty!" , player)end)
end
killer.Game_Values.Player_Credits.Value = killer.Game_Values.Player_Credits.Value + game.Workspace.Data.Bounty.Reward.Value
game.Workspace.Data.Bounty.Reward.Value = 0
game.Workspace.Data.Bounty.Value = nil
end
end
end

victim.CameraMode = Enum.CameraMode.Classic

if game.Players:FindFirstChild(killer.Name) and victim.Game_Values.Player_Flag.Value == false then
spawn(function() removeStam(victim) end)
victim.Character.Humanoid:UnequipTools()
victim.Backpack:ClearAllChildren()
if killer.Name == victim.Name then
info = killer.Name .. " Killed Themself"
spawn(function() inform(killer, "Suicide", "Goodbye Cruel World..", true) end)
game.Workspace.Data.TotalSuicides.Value = game.Workspace.Data.TotalSuicides.Value + 1
game.Workspace.Data.TotalDeaths.Value = game.Workspace.Data.TotalDeaths.Value + 1

elseif killer.TeamColor == victim.TeamColor and killer.Name ~= victim.Name then
info = killer.Name .. " Team Killed " .. victim.Name
spawn(function() inform(killer, "Team Killer", "You killed a Teammate! -1 Credit", false) end)
killer.Game_Values.Player_Credits.Value = plrks.Game_Values.Player_Credits.Value - 1
game.Workspace.Data.TotalDeaths.Value = game.Workspace.Data.TotalDeaths.Value + 1

elseif killer.Name ~= victim.Name then
if killer then
game.Workspace.Data.TotalKills.Value = game.Workspace.Data.TotalKills.Value + 1
game.Workspace.Data.TotalDeaths.Value = game.Workspace.Data.TotalDeaths.Value + 1
info = killer.Name .. " has killed " .. victim.Name
spawn(function() inform(killer, "Kill Confirmed", "You Successfully killed " .. victim.Name .. "! " .. credits .. " Credit(s) // +1 XP", false) end)
spawn(function() inform(victim, "You were Killed!", "You were killed by " .. killer.Name .. "!", true) end)
end
end

if killer.Game_Values.Player_Streak.Value >= 5 then
info = killer.Name .. " has killed " .. victim.Name .. " (" .. killer.Name .. " is on a " .. killer.Game_Values.Player_Streak.Value .. " Kill Streak)"
end

else
info = killer.Name .. " has killed " .. victim.Name
spawn(function() inform(victim, "You were Killed!", "You were killed by a " .. killer.Name .. "!", true) end)
end

running = false
end

cycleFeed()
running = false
end
feed(info)
end

else
for _, player in ipairs(game.Players:GetPlayers()) do

if game.Workspace.Values.GameInProgress.Value then
spawn(function() inform(game.Players:FindFirstChild(char.Name), "Mysterious Death", "How..?", true) end)
end
info = char.Name .. " Has Died Mysteriously"
spawn(function() removeStam(game.Players:FindFirstChild(char.Name)) end)
char.Humanoid:UnequipTools()
game.Players:FindFirstChild(char.Name).Backpack:ClearAllChildren()
end
feed(info)
local playerMessages = {}
messageData[plr] = playerMessages
end
end)
end)
end)
Report Abuse
AutoCarrot is not online. AutoCarrot
Joined: 24 Oct 2013
Total Posts: 5588
21 Jul 2016 11:45 AM
I smell bait, but on the off chance it's legit...

Please use a pastbin and some print statements
Report Abuse
frriend is not online. frriend
Joined: 07 Feb 2010
Total Posts: 577
21 Jul 2016 11:50 AM
Bait? The script is from my game titled classic crusade. There is a game breaking bug and its breaking the game. I usually can debug this stuff but this is confusing. Therefor i'm asking the forums. It's rather sad that you would jump to the conclusion of bait.

http://pastebin.com/j4V8LgVx
Report Abuse
AutoCarrot is not online. AutoCarrot
Joined: 24 Oct 2013
Total Posts: 5588
21 Jul 2016 11:53 AM
What type of script is this, and is FE enabled?

Report Abuse
frriend is not online. frriend
Joined: 07 Feb 2010
Total Posts: 577
21 Jul 2016 11:54 AM
FE is off
Public script in server script storage
Report Abuse
AutoCarrot is not online. AutoCarrot
Joined: 24 Oct 2013
Total Posts: 5588
21 Jul 2016 11:58 AM
Unfamiliar w/ spawn but I suspect that's the issue.


"Executes function f after thread next yields. "
Report Abuse
frriend is not online. frriend
Joined: 07 Feb 2010
Total Posts: 577
21 Jul 2016 12:00 PM
Spawn allows me to create threads so i dont have to wait for a function to run its course, i just spawn a function instead of waiting
Report Abuse
AutoCarrot is not online. AutoCarrot
Joined: 24 Oct 2013
Total Posts: 5588
21 Jul 2016 12:02 PM
But it does have to wait for the thread to next yield?

A similar effect:

function Sub(Func)
return coroutine.resume(coroutine.create(Func))
end
Report Abuse
frriend is not online. frriend
Joined: 07 Feb 2010
Total Posts: 577
21 Jul 2016 12:04 PM
I'm not very experienced with corountine but i believe spawn is a simpler version. I dont think it has to yield because i use it in a lot of other scripts for the same effect. It works fine there, and in this script is broken for some reason.
Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
21 Jul 2016 12:04 PM
rofl you were being useless on another thread

and then i see you posted this

which is a

"edit a free model i don't understand" post

you are something else
Report Abuse
frriend is not online. frriend
Joined: 07 Feb 2010
Total Posts: 577
21 Jul 2016 12:05 PM
Hah free model. Good one.
Report Abuse
AutoCarrot is not online. AutoCarrot
Joined: 24 Oct 2013
Total Posts: 5588
21 Jul 2016 12:06 PM
Use print statements to check. I think it is that
Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
21 Jul 2016 12:06 PM
'Hah free model. Good one."

if you actually understood something like metatables

you would know how to fix a super simple issue like this
Report Abuse
frriend is not online. frriend
Joined: 07 Feb 2010
Total Posts: 577
21 Jul 2016 12:07 PM
Then why don't you help me out instead of trolling.
Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
21 Jul 2016 12:07 PM
"Then why don't you help me out instead of trolling."

why would i help you out if you don't give useful help to others

i'm not trolling, either
Report Abuse
frriend is not online. frriend
Joined: 07 Feb 2010
Total Posts: 577
21 Jul 2016 12:08 PM
Then please leave this thread. I wasn't asking for you to write me a script, i was asking for help with a script i wrote.
Report Abuse
frriend is not online. frriend
Joined: 07 Feb 2010
Total Posts: 577
21 Jul 2016 12:09 PM
Also, the issue isn't even the meta table. If you would have read my problem you would have known that.
Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
21 Jul 2016 12:09 PM
"Then please leave this thread. I wasn't asking for you to write me a script, i was asking for help with a script i wrote."

how ironic considering you assumed someone was demanding a script in another thread when they only wanted help
Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
21 Jul 2016 12:10 PM
"The issue is not the metatable"

metatables are a fairly advanced subject

if you knew how to use those you would easily know how to debug this script by yourself

that leads me to believe you copy and pasted a lot of this code

Report Abuse
frriend is not online. frriend
Joined: 07 Feb 2010
Total Posts: 577
21 Jul 2016 12:11 PM
I told you the problem is not meta tables, i don't know why your still on the subject.
Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
21 Jul 2016 12:11 PM
your iq is very low

i'm using metatables as evidence that you are using a free model
Report Abuse
frriend is not online. frriend
Joined: 07 Feb 2010
Total Posts: 577
21 Jul 2016 12:13 PM
Okay, first off, i'm not denying that the:

local MAX_MESSAGES = 3
local messageData = setmetatable({}, {__mode='k'})

local function storeMessage(message)
if game.Workspace.Values.GameInProgress.Value == true then
local tick = game.ReplicatedStorage.Sounds.killfeed_tk:Clone()
tick.Parent = game.Workspace
tick:Play()
end
for _, player in pairs(game.Players:GetPlayers()) do
local filteredMessage = message
local playerMessages = messageData[player]
table.insert(playerMessages, filteredMessage)
if #playerMessages > MAX_MESSAGES then
table.remove(playerMessages, 1)
end
print(message)
game.ReplicatedStorage.SendFeed:FireClient(player, playerMessages)
end
end

code is a free model. I took that from roblox yes, but the focus is on the code i wrote (Everything Else)

Its honestly not that hard to understand what i need help with.
Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
21 Jul 2016 12:14 PM
"Its honestly not that hard to understand what i need help with."

if it's easy to understand then why can't you figure it out yourself
Report Abuse
frriend is not online. frriend
Joined: 07 Feb 2010
Total Posts: 577
21 Jul 2016 12:15 PM
Listen, i'm not on this forum to argue, i'm here to get help. I don't need to prove anything to you.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image