Skip to content

Instantly share code, notes, and snippets.

@gamebox777
gamebox777 / LocalScriptInput
Last active April 27, 2024 15:10
roblox:LocalScriptInput.lua プレイヤーの入力を受け取る部分
-- UserInputServiceを取得し、プレイヤーの入力を検出するためのサービスを利用
local UserInputService = game:GetService("UserInputService")
-- ReplicatedStorageサービスを取得
local ReplicatedStorage = game:GetService("ReplicatedStorage")
-- ReplicatedStorageから「ModuleScriptBullet」という名前のModuleScriptを取得してロード
local fireBulletModule = require(ReplicatedStorage:WaitForChild("ModuleScriptBullet")) -- ModuleScript をロード
-- プレイヤーの入力が始まった際に呼び出される関数
@gamebox777
gamebox777 / ModuleScriptFireBullet
Last active April 27, 2024 15:10
roblox:ModuleScriptFireBullet
-- モジュールの初期化
local module = {}
-- RobloxのReplicatedStorageサービスを取得
local ReplicatedStorage = game:GetService("ReplicatedStorage")
-- ReplicatedStorageから「Bullet01」という名前の子要素(弾のテンプレート)を待機して取得
local bulletTemplate = ReplicatedStorage:WaitForChild("Bullet01")
-- 弾を発射する関数定義。引数playerには、弾を発射するプレイヤーの情報が渡される。
@gamebox777
gamebox777 / gist:4fa09bcca3bf42cc31753f44b9287739
Created April 10, 2024 07:34
roblox 空間に入ったら死ぬ処理 ロブロックス
-- このスクリプトは、特定の空間を表すパーツにアタッチして使用します。
-- パーツに触れたオブジェクト(主にプレイヤーのキャラクターの一部)を検出し、
-- プレイヤーを「死亡」させる機能を持っています。
-- パーツに触れたオブジェクトを検出する関数を定義します。
-- other: パーツに触れたオブジェクト。プレイヤーのキャラクターの一部が該当します。
local function onPartEntered(other)
-- 触れたオブジェクトの親要素(キャラクター)を取得します。
local character = other.Parent
-- キャラクターからHumanoidオブジェクトを検索します。Humanoidオブジェクトは、
@gamebox777
gamebox777 / gist:c6fde7b3702448cbfa49179aa06d139d
Created April 10, 2024 07:26
roblox 当たったら死ぬ処理 ロブロックス
-- このスクリプトを死亡トリガーとしたいブロックにアタッチしてください。
-- タッチイベントを検出する関数
local function onTouched(other)
-- otherはタッチしたオブジェクト。この場合はプレイヤーのキャラクターの一部。
local character = other.Parent -- プレイヤーのキャラクターを取得
local humanoid = character:FindFirstChildOfClass("Humanoid") -- Humanoidオブジェクトを取得
-- Humanoidが存在し、生きている場合にのみ実行
if humanoid and humanoid.Health > 0 then
@gamebox777
gamebox777 / コード.gs
Created October 10, 2020 13:51
GASのガチャプログラム
//
//グローバル変数
//
//メモ:getRange(row=行,column=列)
const spread = SpreadsheetApp.getActiveSpreadsheet();
//
//データ
//
@gamebox777
gamebox777 / ScrollView00.cs
Created September 25, 2020 12:52
スクロールビューの
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Serialization;
using UnityEngine.UI;
public class ScrollView00 : MonoBehaviour
{
/// <summary> ボタン親子付け用ルート </summary>
@gamebox777
gamebox777 / Missile01Script.cs
Last active June 28, 2020 14:10
ミサイルの向きスクリプト
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Missile01Script : MonoBehaviour
{
/// <summary> ターゲット(キューブ)</summary>
public GameObject mTarget;
/// <summary> 向きを変えるスピード</summary>
@gamebox777
gamebox777 / Quaternion02.cs
Last active June 27, 2020 15:06
Quaternion超入門2
using UnityEngine;
using TMPro;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace Quaternion02
{
/// <summary>
/// 任意の回転軸に沿って回転させる
@gamebox777
gamebox777 / Quaternion01
Created June 26, 2020 15:30
クォータニオン超入門:軸に沿って回転させる
using UnityEngine;
using TMPro;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace Quaternion01
{
public class Quaternion01 : MonoBehaviour
{
@gamebox777
gamebox777 / SaveLoadTest.cs
Last active April 16, 2020 16:57
Bayat Save System使ってみた
//
//更新履歴
// 2版:2020/4/17:Dictionaryを使用した読み書き追加
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Bayat.SaveSystem;
public class SaveLoadTest : MonoBehaviour