So, my problem is this code here i made and i need help making to where if a player gets 3 spree then the gui is basically put in their overhead and is now shown. and only able to be overhead the player who did the kills. last issue i ran across was that the player who did the kill didn’t get the overhead gui now it’s just all messed up now and i just gave up at this point and i have no idea what else to do i tried everything i could do for myself. would love to have help please.
local check = game.ServerStorage:WaitForChild(“BillboardGui”):Clone()
clone = game.ServerStorage:FindFirstChild(“BillboardGui”):Clone()
local debounce = false
local statss = player:FindFirstChild("leaderstats")
local spree2 = statss.Spree.Value
local spree = statss.Spree
spree.Changed:Connect(function(NewValue)
if spree.Value >= 3 and NewValue.Value >= 3 or spree.Value == 3 and NewValue.Value == 3 then
local tag = Instance.new("ObjectValue")
tag.Value = Character -- this can either be the shooters character or plr object (adjust accordingly if you use character)
tag.Name = "creator"
tag.Parent = Character.Humanoid -- this is the enemies humanoid, again can be parented to their character (adjust to it if you use character)
game:GetService("Debris"):AddItem(tag,.5) -- destroys tag after half a second
Character.Humanoid.Died:connect(function()
local you = Character:FindFirstChild("creator")
local clonedguis = clone
clonedguis.Parent = Character.Head
clonedguis.Parent = Character.Head
clonedguis.SpreeTag.Text = "☠️Spree|".. spree.Value or NewValue.Value
clonedguis.SpreeTag.TextTransparency = 0
debounce = true
end)
end
end)
end)
end)
just for the player who did the kill. like if i killed 3 players basically then i should get the overhead gui to show up and start showing my spree and no one else should have it but should be able to see it
yea i didn’t put detect the person l i have no idea how i got everything else down though this is just my first time making this type of code in general i usually do edits and stuff now it’s my first code i made and i just don’t understand how i can make it detect the person who has the 3 spree instead of giving it wrong
thats why “tag” is in the code. i added that cause i was gonna mess around with it and i did and just i did everything i could think of to make it work and i really can’t do it
You should check if a player, in this case, you. You are able to damage someone until their health is 0 (equals to or below zero, since sometimes their health can go below 0), and you can fire a RemoteEvent, hence displaying the GUI.
First of all, RemoteEvents is a kind of function that is used for one-way communication from either the Client to Server or vice-versa. You can also do it from a Server to All Clients (all LocalPlayers). Understand until this point?
yea i can understand that. i’ve experienced with RemoteEvents i can understand how they work but don’t know how to put it in code lol i’ve only tried doing it once and was successful so i got some knowledge on it just not enough for this lol i haven’t tried using remote events with this type of code
Oh, you can make a function in order to make the GUI to show up. You can do this:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("yourRemoteEventName")
local function displayGui -- The name can be anything.
-- Insert your code here.
end
remoteEvent.OnServerEvent:Connect(displayGui) -- Again, use your function name.
local clonedguis = clone
clonedguis.Parent = Character.Head
local statss = player:FindFirstChild("leaderstats")
local spree2 = statss.Spree.Value
local spree = statss.Spree
spree.Changed:Connect(function(NewValue)
local clonedguis = clone
local function GUI ()
if spree.Value >= 3 or spree.Value == 3 then
SpreeOverHeadGUI:FireServer()
clonedguis.Parent = Character.Head
clonedguis.Parent = Character.Head
clonedguis.SpreeTag.Text = "☠️Spree|".. spree.Value or NewValue.Value
clonedguis.SpreeTag.TextTransparency = 0
SpreeOverHeadGUI.OnServerEvent:Connect(GUI)
end
end
end)
end)
end)
do i really have to make it different. it won’t fire once spree is 3 lol i tried other ways with it but couldnt do it does work just won’t run the code when spree 3 basically
and yea killed another player yeee idk would i have to add this into my sword script then cause it has that function already just not the remote event basically
messed up lol i sent wrong code but i got it down, i have looked around at my code i have in my game that has Events in them and i think i got that part down. i just eh not that good on rest i can’t