--serverscript
local event = game.ReplicatedStorage:WaitForChild("timeAbility")
local ts = game:GetService("TweenService")
local tsSound = game.Workspace.sounds.tsStart
local tsResume = game.Workspace.sounds.tsResume
local lastUsedTime = 0
local cooldownTime = 15
event.OnServerEvent:Connect(function(player)
local currentTime = tick()
if currentTime - lastUsedTime < cooldownTime then
print(player.Name .. "is on ts cd")
return
end
lastUsedTime = currentTime
print(player.Name)
for i, plr in game.Players:GetPlayers() do
if plr and plr ~= player then
local char = plr.Character
for i, v in char:GetChildren() do
if v:IsA("Part") then
v.Anchored = true
end
end
tsSound:Play()
wait(0.7)
local tween1 = ts:Create(game.Lighting.ColorCorrection, TweenInfo.new(2), {Saturation = -1})
tween1:Play()
task.wait(5)
tsResume:Play()
local tween2 = ts:Create(game.Lighting.ColorCorrection, TweenInfo.new(2), {Saturation = 0})
tween2:Play()
tween2.Completed:Wait()
for i, v in char:GetChildren() do
if v:IsA("Part") then
v.Anchored = false
end
end
end
end
end)
--localscript
local uis = game:GetService("UserInputService")
local db = false
local event = game.ReplicatedStorage:WaitForChild("timeAbility")
local cooldownTime = 6
local lastUsedTime = 0
uis.InputBegan:Connect(function(input, typing)
if input.KeyCode == Enum.KeyCode.X and not typing and db == false then
local currentTime = tick()
if currentTime - lastUsedTime < cooldownTime then
print("ts global cd")
return
end
lastUsedTime = currentTime
db = true
task.wait(0.7)
event:FireServer()
task.wait(15)
db = false
end
end)
To embed this program on your website, copy the following code and paste it into your website's HTML: