Skip to content

Instantly share code, notes, and snippets.

View MajorTal's full-sized avatar

Tal Weiss MajorTal

View GitHub Profile
local tool = script.Parent
local deleteRequest = tool:WaitForChild("DeleteRequest")
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
tool.Activated:Connect(function()
if mouse.Target and mouse.Target:IsA("BasePart") then
deleteRequest:FireServer(mouse.Target)
end
end)
local tool = script.Parent
local placeRequest = tool:WaitForChild("PlaceRequest")
local GRID_SIZE = 4 -- Grid snapping size
local function snapToGrid(position, gridSize)
return Vector3.new(
math.floor(position.X / gridSize + 0.5) * gridSize,
position.Y,
math.floor(position.Z / gridSize + 0.5) * gridSize
local GRID_SIZE = 4 -- Grid snapping size
local function snapToGrid(position, gridSize)
return Vector3.new(
math.floor(position.X / gridSize + 0.5) * gridSize,
position.Y,
math.floor(position.Z / gridSize + 0.5) * gridSize
)
end
local GRID_SIZE = 4 -- Grid snapping size (adjust as needed)
local function snapToGrid(position, gridSize)
return Vector3.new(
math.floor(position.X / gridSize + 0.5) * gridSize,
position.Y,
math.floor(position.Z / gridSize + 0.5) * gridSize
)
end
local tool = script.Parent
local placeRequest = tool:WaitForChild("PlaceRequest")
local Players = game:GetService("Players")
-- Helper function to validate room assignment
local function isWithinAssignedRoom(player, position)
local roomName = player:GetAttribute("Room")
if not roomName then return false end
local room = workspace.PlayerRooms:FindFirstChild(roomName)
local DataStoreService = game:GetService("DataStoreService")
local cashDataStore = DataStoreService:GetDataStore("PlayerCash")
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local Players = game:GetService("Players")
local rooms = workspace.PlayerRooms:GetChildren()
local roomAssignments = {}
local signsFolder = workspace.Signs
-- Shuffle rooms for randomness (optional)
local function shuffle(tbl)
for i = #tbl, 2, -1 do
local j = math.random(i)
local Players = game:GetService("Players")
local rooms = workspace.PlayerRooms:GetChildren()
local roomAssignments = {}
-- Shuffle rooms for randomness (optional)
local function shuffle(tbl)
for i = #tbl, 2, -1 do
local j = math.random(i)
tbl[i], tbl[j] = tbl[j], tbl[i]
end
import logging
from dataclasses import dataclass, field
from typing import Annotated, Optional
from dotenv import load_dotenv
from livekit.agents import (
Agent,
AgentSession,
ChatContext,
JobContext,
from numpy.random import choice as random_choice, randint as random_randint, rand
MAX_INPUT_LEN = 40
AMOUNT_OF_NOISE = 0.2 / MAX_INPUT_LEN
CHARS = list("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ .")
def add_noise_to_string(a_string, amount_of_noise):
"""Add some artificial spelling mistakes to the string"""
if rand() < amount_of_noise * len(a_string):
# Replace a character with a random character
random_char_position = random_randint(len(a_string))