Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I'm making an axe, but there's an error, output says '(expected Vector3, got CFrame)' ?

Asked by 5 years ago
Edited 5 years ago
01local exampleModel_tree1 = workspace.exampleModel_tree1
02tool = script.Parent
03local localScriptText_testing = workspace.localScriptText_testing
04local SurfaceGui = localScriptText_testing.SurfaceGui
05local TextLableMessageOutput = SurfaceGui.TextLabel
06local player = game.Players.LocalPlayer
07local mouse = player:GetMouse()
08local HumanoidRootPart = workspace[player.Name].HumanoidRootPart
09tool.Equipped:Connect(function()
10   TextLableMessageOutput.Text = "tool was equipped"
11    tool.Activated:Connect(function()
12      TextLableMessageOutput.Text = "mouse was clicked"
13      if mouse.Target and mouse.Target.Parent then
14         if mouse.Target.CFrame == exampleModel_tree1.tree1Part1_trunk.CFrame and not HumanoidRootPart.**Position **<= exampleModel_tree1.tree1Part1_trunk.CFrame + CFrame.new(1,0,0 or 2,0,0 or 3,0,0) then
15      if HumanoidRootPart.**Position** <= exampleModel_tree1.tree1Part1_trunk.CFrame +  CFrame.new(1,0,0 or 2,0,0 or 3,0,0) then
View all 29 lines...
0
The code you have posted seems to have parts of highlighted. Could you post the exact code you're using without any annotations, so that it would be easier to read? gskw 1046 — 5y

1 answer

Log in to vote
0
Answered by 3 years ago

It looks like you're mixing a CFrame with a position. A coordinate frame stores a position plus a rotational matrix. So you could just grab the .Position from the CFrames, and that should fix it. So (exampleModel_tree1.tree1Part1_trunk.CFrame + CFrame.new(1,0,0 or 2,0,0 or 3,0,0)).Position instead.

Ad

Answer this question