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

Unable to cast Instance to CoordinateFrame?

Asked by 2 years ago

***`game.Players.PlayerAdded:Connect(function(Player) Player.CharacterAdded:Connect(function(Character) local Case = script.Case:Clone() Case:SetPrimaryPartCFrame(Character.HumanoidRootPart) Case.Parent = Character

  local weld = Instance.new("ManualWeld")
    weld.Part0 = Case.PrimaryPart
    weld.Part1 = Character.PrimaryPart
    weld.C0 = weld.Part0.CFrame:ToObjectSpace(weld.Part1.CFrame)
    weld.Parent = weld.Part0
    
    local Sword = script.Katana:Clone()
    Sword:SetPrimaryPartCFrame(Case.Case.CFrame * CFrame.new(0,-125,2.65))
    Sword.Parent = Character
  
    local weld2 = Instance.new("ManualWeld")
    weld2.Part0 = Sword.PrimaryPart
    weld2.Part1 = Character.PrimaryPart
    weld2.C0 = weld2.Part0.CFrame:ToObjectSpace(weld2.Part1.CFrame)
    weld2.Parent = weld2.Part0
  

end) end)`***

This is my code and when i hit play and this freaking error ...

Unable to cast Instance to CoordinateFrame

what should i do :_)

1 answer

Log in to vote
0
Answered by 2 years ago

The error means there is an instance where there should be a CFRAME. Please check your code thoroughly before posting an issue. There is an error with the cases primarypartcframe

Case:SetPrimaryPartCFrame(Character.HumanoidRootPart.CFrame)
0
ty bro im starting learning lua and im noob :T ArastooYsf86 2 — 2y
0
NP Arastoo, If you need help You can message me iNi#2338 Kingu_Criminal 205 — 2y
Ad

Answer this question