Skip to content

Instantly share code, notes, and snippets.

View bubu07codes's full-sized avatar
:bowtie:
I may be slow to respond.

Bubu07 bubu07codes

:bowtie:
I may be slow to respond.
View GitHub Profile
-- Put this in a Part (:
local gui = Instance.new("SurfaceGui") -- Creates a SurfaceGui
gui.Parent = script.Parent -- Don’t forget to set the parent!
gui.SizingMode = "PixelsPerStud" -- Same as Enum.SurfaceGuiSizingMode.PixelsPerStud
local text = Instance.new("TextLabel") -- Creates a TextLabel
text.Parent = gui -- Parent to the gui
text.Size = UDim2.fromScale(1,1) -- Gets scaled to Max (x,y)
text.BackgroundTransparency = 1 -- Sets background transparency to 1 (fully transparent)
@bubu07codes
bubu07codes / TouchExample.luau
Created December 29, 2024 21:22
Understand the use of touched event in Roblox
local part = script.Parent -- The Part
part.Touched:Connect(function(hit) -- Every time something touches the part
print(hit) -- This is the Instance what touched the part
if hit:IsA("Part") then -- If the Instance is a Part Type
hit.Color = Color3.new(0.5, 0, 1) -- Set the touched Part color to Purple
end
end)
@bubu07codes
bubu07codes / LeaderstatsTemplate.luau
Created December 29, 2024 21:19
Simple leaderstats template by BubuTheDev
-- Simple leaderstats template by BubuTheDev
-- Creates a folder called "leaderstats" (needs to be exact, dont change!)
-- Creates a value called Points with a starting value of 0
-- Every second Points will get increased by 1
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
@bubu07codes
bubu07codes / BubuTheDevDataStore.luau
Created December 29, 2024 21:13
BubuTheDev’s Simple DataStore
--BubuTheDev’s Simple DataStore
--Saves player’s leaderstats when leaves or disconnected
--Loads and sets the leaderstats when joining the game.
local Players = game:GetService("Players")
local DataStoreService = game:GetService("DataStoreService")
local SAVE_NAME = "LeaderstatsData" --changing it will change data (can be used for testing purposes)
local Data = DataStoreService:GetDataStore(SAVE_NAME)