Hi, I am a new developer that is currently making a game, I am right now working on adding status effects in my game, there are two scripts I use to manage the effects, one being the script that performs actions, the second is the script that shows a Gui when that effect is on.
The first script is fine and doesn’t have any problems, but the Gui script is what I really need help with, because it doesn’t show that Gui.
I tried putting everything in one script, but it didn’t work, I do know a little about server and client, but I don’t know anything else about it other than knowing not to test with the client. The objective here for me is when that effect is turned on, that effect will also show the Gui image and will turn it off once it ends.
Effect script:
local human = script.Parent.Humanoid
local walk = human.WalkSpeed
local jump = human.JumpPower
local speedcontrolF = nil
local jumpcontrolF = nil
script:GetAttributeChangedSignal("Burn"):Connect(function()
if script:GetAttribute("Burn") then
for i = 1, 20, 1 do
human.Health = math.ceil(human.Health - human.MaxHealth / 50)
wait(0.5)
end
script:SetAttribute("Burn",false)
end
end)
script:GetAttributeChangedSignal("Poison"):Connect(function()
if script:GetAttribute("Poison") then
for i = 1, 10, 1 do
human.Health = math.ceil(human.Health - human.Health / 10)
wait(1)
end
script:SetAttribute("Poison",false)
end
end)
script:GetAttributeChangedSignal("Bleed"):Connect(function()
if script:GetAttribute("Bleed") then
human.Health = math.ceil(human.Health - 20)
human.MaxHealth = human.MaxHealth - 50
for i = 1, 20, 1 do
human.Health = math.ceil(human.Health - human.MaxHealth / 20)
wait(1)
end
human.MaxHealth = human.MaxHealth + 50
human.Health = math.ceil(human.Health + 50)
script:SetAttribute("Bleed",false)
end
end)
script:GetAttributeChangedSignal("Freeze"):Connect(function()
if script:GetAttribute("Freeze") then
speedcontrolF = human.WalkSpeed
jumpcontrolF = human.JumpPower
human.WalkSpeed = 0
human.JumpPower = 0
for i = 1, 20, 1 do
human.Health = math.ceil(human.Health - human.MaxHealth / 50)
wait(0.5)
end
human.WalkSpeed = speedcontrolF
human.JumpPower = jumpcontrolF
script:SetAttribute("Freeze",false)
end
end)
Here is the gui manager:
repeat wait(1) until game:IsLoaded()
local player = game.Players.LocalPlayer
local char = player.Character
local Effects = char.EffectScript
local mainui = player.PlayerGui.UserInterface["Health Frame"]["Effect Indicators"]
print(mainui)
script:GetAttributeChangedSignal("Burn"):Connect(function()
if Effects:GetAttribute("Burn") then
mainui.Burn.ImageTransparency = 0
else
mainui.Burn.ImageTransparency = 1
end
end)
script:GetAttributeChangedSignal("Poison"):Connect(function()
if Effects:GetAttribute("Poison") then
mainui.Poison.ImageTransparency = 0
else
mainui.Poison.ImageTransparency = 1
end
end)
script:GetAttributeChangedSignal("Bleed"):Connect(function()
if Effects:GetAttribute("Bleed") then
mainui.Bleed.ImageTransparency = 0
else
mainui.Bleed.ImageTransparency = 1
end
end)
script:GetAttributeChangedSignal("Freeze"):Connect(function()
if Effects:GetAttribute("Freeze") then
mainui.Freeze.ImageTransparency = 0
else
mainui.Freeze.ImageTransparency = 1
end
end)
This is a reupload of an unsolved problem because i still need to solve the problem, Comments From previous uploads will show up here!