0% found this document useful (0 votes)
5 views

main.lua (4)

The document is a Lua script for a game hub called 'Cool Kid' that utilizes the Rayfield library. It includes features such as a Discord integration, a key system for access, and an 'Auto Parry' button that triggers a parry action in response to specific game events. The script also contains functions for verifying game objects and handling notifications for user interactions.

Uploaded by

crystals9810
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

main.lua (4)

The document is a Lua script for a game hub called 'Cool Kid' that utilizes the Rayfield library. It includes features such as a Discord integration, a key system for access, and an 'Auto Parry' button that triggers a parry action in response to specific game events. The script also contains functions for verifying game objects and handling notifications for user interactions.

Uploaded by

crystals9810
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

local Rayfield = loadstring(game:HttpGet('https://sirius.

menu/rayfield'))()

local Window = Rayfield:CreateWindow({


Name = "Cool Kid",
LoadingTitle = "Cool Kid",
LoadingSubtitle = "by blade",
ConfigurationSaving = {
Enabled = true,
FolderName = nil, -- Create a custom folder for your hub/game
FileName = "Cool Kid Hub"
},
Discord = {
Enabled = True,
Invite = "https://discord.com/invite/PrV7fg7r", -- The Discord invite code,
do not include discord.gg/. E.g. discord.gg/ABCD would be ABCD
RememberJoins = true -- Set this to false to make them join the discord every
time they load it up
},
KeySystem = True, -- Set this to true to use our key system
KeySettings = {
Title = "cool Kid key",
Subtitle = "Join in Discord Server",
Note = "Note join discord server for key",
FileName = "Cool Kid Key", -- It is recommended to use something unique as
other scripts using Rayfield may overwrite your key file
SaveKey = true, -- The user's key will be saved, but if you change the key,
they will be unable to use your script
GrabKeyFromSite = True, -- If this is true, set Key below to the RAW site you
would like Rayfield to get the key from
Key = {"https://pastebin.com/bnPCZ8LS"} -- List of keys that will be accepted
by the system, can be RAW file links (pastebin, github etc) or simple strings
("hello","key22")
}
})

local MianTab = Window:CreateTab("🏠 home", Nil) -- Title, Image


local MainSection = MainTab:CreateSection("Main")

Rayfield:Notify({
Title = "you exucute the script",
Content = "Notification Content",
Duration = 6.5,
Image = nil,
Actions = { -- Notification Buttons
Ignore = {
Name = "Okay!",
Callback = function()
print("The user tapped Okay!")
end
},
},
})

local Button = MainTab:CreateButton({


Name = "Auto Parry",
Callback = function()
local Debug = false -- Set this to true if you want my debug output.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local Player = Players.LocalPlayer or Players.PlayerAdded:Wait()
local Remotes = ReplicatedStorage:WaitForChild("Remotes", 9e9) -- A second argument
in waitforchild what could it mean?
local Balls = workspace:WaitForChild("Balls", 9e9)

-- Functions

local function print(...) -- Debug print.


if Debug then
warn(...)
end
end

local function VerifyBall(Ball) -- Returns nil if the ball isn't a valid


projectile; true if it's the right ball.
if typeof(Ball) == "Instance" and Ball:IsA("BasePart") and
Ball:IsDescendantOf(Balls) and Ball:GetAttribute("realBall") == true then
return true
end
end

local function IsTarget() -- Returns true if we are the current target.


return (Player.Character and Player.Character:FindFirstChild("Highlight"))
end

local function Parry() -- Parries.


Remotes:WaitForChild("ParryButtonPress"):Fire()
end

-- The actual code

Balls.ChildAdded:Connect(function(Ball)
if not VerifyBall(Ball) then
return
end

print(`Ball Spawned: {Ball}`)

local OldPosition = Ball.Position


local OldTick = tick()

Ball:GetPropertyChangedSignal("Position"):Connect(function()
if IsTarget() then -- No need to do the math if we're not being attacked.
local Distance = (Ball.Position -
workspace.CurrentCamera.Focus.Position).Magnitude
local Velocity = (OldPosition - Ball.Position).Magnitude -- Fix
for .Velocity not working. Yes I got the lowest possible grade in accuplacer math.

print(`Distance: {Distance}\nVelocity: {Velocity}\nTime: {Distance /


Velocity}`)

if (Distance / Velocity) <= 10 then -- Sorry for the magic number. This
just works. No, you don't get a slider for this because it's 2am.
Parry()
end
end

if (tick() - OldTick >= 1/60) then -- Don't want it to update too quickly
because my velocity implementation is aids. Yes, I tried Ball.Velocity. No, it
didn't work.
OldTick = tick()
OldPosition = Ball.Position
end
end)
end)
end,
})

You might also like