Hi, I'm scripting a stone attack for my magic ffa game, I'm good at this sorta thing but you could search the entire planet and still not find a scripter my level who's as awful at CFrame as me.
So, I was wondering. How would I turn a vector3 into a CFrame?
Here's a server script that handles the attack thing:
script.Parent.OnServerEvent:connect(function(player, mouse)
if game.Players[player.Name].Character.HumanoidRootPart:FindFirstChild("AimerGyro") then
print("aiming")
local gryo = game.Players[player.Name].Character.HumanoidRootPart:FindFirstChild("AimerGyro")
gryo.CFrame = mouse
else
print("making")
local g = Instance.new("BodyGyro")
g.Name = "AimerGyro"
g.Parent = game.Players[player.Name].Character.HumanoidRootPart
end
end)
To clarify, that mouse variable is mouse.hit sent over from the client.
And here is that client script:
local uis = game:GetService("UserInputService")
local equipped = false
local attacking = false
local debounce = false
local debounce2 = false
local mouse = game.Players.LocalPlayer:GetMouse()
script.Parent.Equipped:connect(function()
equipped = true
end)
script.Parent.Unequipped:connect(function()
equipped = false
end)
uis.InputBegan:connect(function(input, gp)
if gp then
return
else
if input.KeyCode == Enum.KeyCode.Q and not attacking and not debounce then
attacking = true
debounce = true
while attacking do
if attacking then
script.Parent.StoneQ:FireServer(mouse.hit)
else
break
end
wait(0.1)
end
-- charge
print("charging")
wait(4)
debounce = false
end
end
end)
uis.InputEnded:connect(function(input, gp)
if gp then
return
else
if input.KeyCode == Enum.KeyCode.Q and attacking and not debounce2 then
attacking = false
debounce2 = true
-- release
print("released")
wait(4)
debounce2 = false
end
end
end)

1 comment
CFrame.new(Vector3) LMAOOO