0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

概要

robloxでassistantやってみた。
練習問題やってみた。

練習問題

スクリプトだけで、飛ぶボタンを作れ。

手順

  • ReplicatedFirstに、LocalScriptを追加。
  • スクリプトを書く。

local Players = game:GetService("Players")
local character = game:GetService("Players").LocalPlayer.Character or game:GetService("Players").LocalPlayer.CharacterAdded:Wait()
local Player = Players.LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")
local Gui = Instance.new("ScreenGui")
Gui.Parent = PlayerGui
local button = Instance.new("TextButton")
button.Name = "button"
button.BorderSizePixel = 0
button.TextSize = 20
button.TextColor3 = Color3.new(1, 0.2, 0.4)
button.AnchorPoint = Vector2.new(0.5, 0.5)
button.Size = UDim2.new(0.1, 0, 0.1, 0)
button.Position = UDim2.new(0.5, 0, 0.5, 0)
button.SizeConstraint = Enum.SizeConstraint.RelativeYY
button.Text = "fly"
button.Parent = Gui
button.Active = true
button.MouseButton1Click:Connect(function()
	if character then
		local bodyGyro = Instance.new("BodyGyro")
		bodyGyro.MaxTorque = Vector3.new(1, 1, 1) * 10^6
		bodyGyro.P = 10^6
		local bodyVel = Instance.new("BodyVelocity")
		bodyVel.MaxForce = Vector3.new(1, 1, 1) * 10^6
		bodyVel.P = 10^4
		bodyGyro.Parent = character.HumanoidRootPart
		bodyVel.Parent = character.HumanoidRootPart
		bodyGyro.CFrame = character.HumanoidRootPart.CFrame
		bodyVel.Velocity = Vector3.new(0, 1, 0)
	end
end)



写真

image.png

以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?