local:
local UIS = game:GetService("UserInputService")
local char = script.Parent
local RE = game.ReplicatedStorage.Revive
UIS.InputBegan:Connect(function(input, gameProcessed)
if gameProcessed then return end
if input.KeyCode == Enum.KeyCode.G then
RE:FireServer(char)
print("Used revive ability")
end
end)
server:
local RE = game.ReplicatedStorage.Revive
RE.OnServerEvent:Connect(function(player, char)
local sphere = Instance.new("Part")
sphere.Parent = workspace
sphere.Shape = Enum.PartType.Ball
sphere.Position = char.PrimaryPart.Position
sphere.Size = Vector3.new(10, 10, 10)
sphere.CanCollide = false
sphere.Anchored = true
sphere.Transparency = 0.8
for i=1,10 do
wait(0.1)
sphere.Size = sphere.Size + Vector3.new(2, 0, 2)
sphere.Touched:Connect(function(part)
local downed = part.Parent:FindFirstChild("Downed")
local hum = part.Parent:FindFirstChild("Humanoid")
if downed and downed.Value == true then
downed.Value = false
hum.MaxHealth = 100
hum.Health = 100
print("Found downed")
end
end)
end
sphere:Destroy()
end)
So currentl I have script for revive spell. How can I improve this code, so I can add more spells in one code, not creating new Remote Events? (if it is possible)