0
私はRoblox for my gameのヘルスパックをやっています。コードが完成し、それが完璧に動作しますが、私は健康パック自体は私のコードはRoblox無限回転ループ
local healthPack = script.Parent
local healAmount = 30
local cooldown = 5
local canHeal = true
local function handleTouch(otherPart)
local character = otherPart.Parent
local humanoid = character:FindFirstChild('Humanoid')
if humanoid and canHeal then
if game.Workspace.Player1.Humanoid.Health == 100 then
print("You have enough health")
else
canHeal = false
game.Workspace.HealthPack.Transparency = .75
local currentHealth = humanoid.Health
local newHealth = currentHealth + healAmount
humanoid.Health = newHealth
wait(cooldown)
canHeal = true
game.Workspace.HealthPack.Transparency = 0
end
end
end
healthPack.Touched:connect(handleTouch)
while true do
local currentRotationX = game.Workspace.HealthPack.Rotation.X
--local currentRotationX = game.Workspace.HealthPack.Rotation.Y
local currentRotationZ = game.Workspace.HealthPack.Rotation.Z
game.Workspace.HealthPack.Rotation.X = currentRotationX + 10
--game.Workspace.HealthPack.Rotation.Y = currentRotationY + 10
game.Workspace.HealthPack.Rotation.Z = currentRotationZ + 10
wait(.5)
end
ありがとうございましたが、CFrameは何ですか? –
ROBLOX Developer WikiでCFrameを検索することをお勧めします。簡単な説明として、レンガの向き(回転)と位置を制御するすべてのレンガのプロパティです。ローテーションは少し複雑ですが、CFramesのローテーションを処理するために掘り下げたい場合は、基本的な幾何学的な知識を少なくともいくつかお勧めします。 –
もう一つの問題があります。私はそれを瞬時に回転させたいと思っていますが、あなたのコードはそれを速く回転させ、遅くなるのでここに問題があります。 –