我一直在为Roblox制作剧本。这是代码:
local UIS = game:GetService("UserInputService")
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local Activation =
Instance.new("Sound",game.Players.LocalPlayer.Character.Head)
local char = Player.Character
local hum = char.Humanoid
local root = char.HumanoidRootPart
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.F then
Activation.SoundId = "rbxassetid://1581091676" --Plays Mangekyou Sharingan Activation Sound.
Activation:Play()
wait(0.3)
game.Players.LocalPlayer.Character.Head.face.Texture = "rbxassetid://76285632" --When F is pressed, face texture changes to sharingan decal.
game:GetService("Chat"):Chat(Player.Character.Head, "Mangekyou Sharingan!")
end
end)
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.R then
Activation.SoundId = "rbxassetid://1580990602" --Plays Amaterasu Activation Sound.
Activation:Play()
game:GetService("Chat"):Chat(Player.Character.Head, "Amaterasu!")
local Target = Instance.new("Part") --makes a part
Target.Parent = game.Workspace
Target.Position = Vector3.new(Mouse.target.Position) --makes the part spawn where the mouse is
Target.Transparency = 1
Target.Anchored = true
Target.CanCollide = false
local Amaterasu = Instance.new("Fire")
Amaterasu.Parent = game.Workspace.Part
Amaterasu.Color = Color3.new(0,0,0)
Amaterasu.SecondaryColor = Color3.new(0,0,0) --amaterasu properties
Amaterasu.Size = 25
local R = Instance.new("RocketPropulsion") --rocket propulsion, parents amaterasu
R.Parent = Amaterasu
R.MaxThrust = 300
R.ThrustP = 30
R:Fire()
end
end)
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.G then
game.Players.LocalPlayer.Character.Head.face.Texture = "rbxassetid://22557247" --When G is pressed, face texture changes back to normal.(leaves face blank isnt working :/)
end
end)
-----------------------------
我需要帮助的是在游戏中产生我的鼠标当前位置的父母amaterasu射击的部分。我研究并尝试了Target.Position = Vector3.new(Mouse.target.Position)
和Target.Position = Vector3.new(Mouse.Hit)
。
这些都不起作用,最终的结果是无论我的鼠标在游戏中的位置在哪里,产生在底板中间的部分。
答案 0 :(得分:0)
这是门票
local Part = Instance.new("Part",game.Workspace);
Part.CFrame = Mouse.Hit;
答案 1 :(得分:0)
我们需要一个CFrame。所以我们会做
Target.CFrame = CFrame.new(Mouse.target.Position)
我花了些时间弄清楚这一点,实际上我也在做类似的事情。