I have been having trouble for the past week, here's how far i got before actually coming here to ask for help.The reason why i am here is because to get help on how to make sure it only displays some info once, and not over and over again.
This LocalScript handles everything to do with the player's GUI. In this case the event bar, which displays information on the player's screen, such as who killed who with what.
local Main = script.Parent.Parent.PlayerGui.Main local BattleUI = script.Parent.Parent.PlayerGui.BattleUI local LoTrig = game.ServerStorage.LoTrig ----|----- EventBar -----|---- local EventBar = BattleUI.EventBar local View = BattleUI.EventBar.View local Bar = BattleUI.EventBar.View local Bar1 = View.Bar1 local Bar2 = View.Bar2 local Bar3 = View.Bar3 local Bar4 = View.Bar4 local Bar5 = View.Bar5 local On1 = Bar1.On local On2 = Bar2.On local On3 = Bar3.On local On4 = Bar4.On local On5 = Bar5.On function EventFrameDisplay(K, D, Wep)--Way local LastKill = K local LastDeath = D local LastWeapon = Wep if Bar1.Weapon.Text == "NaN" and On1.Value == false then On1.Value = true elseif Bar2.Weapon.Text == "NaN" and On2.Value == false then On2.Value = true elseif Bar3.Weapon.Text == "NaN" and On3.Value == false then On3.Value = true elseif Bar4.Weapon.Text == "NaN" and On4.Value == false then On4.Value = true elseif Bar5.Weapon.Text == "NaN" and On5.Value == false then On5.Value = true end if On5.Value == true then Bar5.Killer.Text = K Bar5.Killed.Text = D Bar5.Weapon.Text = Wep Bar5.Visible = true wait(4) Bar5.Visible = false Bar5.Weapon.Text = "NaN" On5.Value = false end if On4.Value == true then Bar4.Killer.Text = K Bar4.Killed.Text = D Bar4.Weapon.Text = Wep Bar4.Visible = true wait(4) Bar4.Visible = false Bar4.Weapon.Text = "NaN" On4.Value = false end if On3.Value == true then Bar3.Killer.Text = K Bar3.Killed.Text = D Bar3.Weapon.Text = Wep Bar3.Visible = true wait(4) Bar3.Visible = false Bar3.Weapon.Text = "NaN" On3.Value = false end if On2.Value == true then Bar2.Killer.Text = K Bar2.Killed.Text = D Bar2.Weapon.Text = Wep Bar2.Visible = true wait(4) Bar2.Visible = false Bar2.Weapon.Text = "NaN" On2.Value = false end if On1.Value == true then Bar1.Killer.Text = K Bar1.Killed.Text = D Bar1.Weapon.Text = Wep Bar1.Visible = true wait(4) Bar1.Visible = false Bar1.Weapon.Text = "NaN" On1.Value = false end if Bar2.Killer == Bar1.Killer and Bar2.Killed == Bar1.Killed and Bar2.Weapon == Bar1.Weapon then Bar2.Visible = false print("OK") end --[[Bar.Killer.Text = K Bar.Killed.Text = D Bar.Weapon.Text = Wep Bar.Visible = true wait(4) Bar.Visible = false --]] end LoTrig.Event:connect(EventFrameDisplay) while true do wait(3) LoTrig:Fire(LaLa, Land, AGun) end -- if that doesn't work, then cancel while true do statement and use the one below. --[[ LoTrig.Fire(LaLa, Land, AGun) --]]
This LocalScript is used to fire an event that triggers the function, EventFrameDisplay. This method is used on my custom gun; to fire the LoTrig Event, which in turn, triggers the function that displays the information.
hitHumanoid = findFirstClass(H.Parent, "Humanoid") if hitHumanoid and hitHumanoid.Health > 0 and isEnemy(hitHumanoid) then local Tag = Instance.new("ObjectValue") Tag.Value = Player Tag.Name = "creator" Tag.Parent = hitHumanoid DS:AddItem(Tag, 0.3) local chosenDamage = 0 if H.Name == "Head" then chosenDamage = baseDamage * RAND(hVal, hVal + 0.1, 0.01) elseif H.Name == "Torso" then chosenDamage = baseDamage * RAND(cVal, cVal + 0.1, 0.01) else chosenDamage = baseDamage * RAND(lVal, lVal + 0.1, 0.01) end hitHumanoid:TakeDamage(chosenDamage) markHit() elseif hitHumanoid and hitHumanoid.Health == 0 and isEnemy(hitHumanoid) then -- the event fires under this conditional. LoTrig:Fire(Player.Name, hitHumanoid.Name, script.Parent.Name) end
I have gotten it to work on the previous attempts, but it kept on sending information over and over like this if ran. The event was fired through my own custom gun, but i'll just leave an trigger within the script
This was put into a local script that was placed in game.StarterPlayer.StarterPlayerScripts.
Any answer related to this will be greatly aprecciated.
And if needed, you may ask for the gun script. Here's an piece.
EDIT: Forgot to include the link to the ui.
https://www.roblox.com/games/723299178/Get-ui-element-through-here