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

Morphing Using A Tool Not Working?

Asked by 3 years ago

Hello, I'm trying to morph into a model tool made of meshes I created in Blender, and I need some help fixing problems I've run into. I'm trying to morph myself into the tool by equipping it. I still want to be able to freely move around and jump and stuff, I just want to be the tool. I'm having several problems with this. First, it doesn't even morph; when I equip the tool, it just appears where the model last was, not in my hand nor as my character. The tool has RequireHandle set to false, and when it's true and I name a part "Handle" it still doesn't work. I've also tried morphing using a proximity prompt, which kind of works. Three problems with that: 1) I morphed into the model, but whenever I do the camera stays fixed where my old character was. I've tried setting the camera subject to the new model's HumanoidRootPart in the script but that didn't work. 2) The red outline that shows up when you die appears when I morphed. 3) The morph would only work for a few seconds before disabling, changing my character back, and putting me in a spawn location. I don't know what to do. I'm using a regular script in the tool and using PlayHere to test. This is my code:

local tool = script.Parent
local morph = tool:FindFirstChildOfClass("Model")
tool.Equipped:Connect(function(player)
    print("Works")
    local oldchar = player.Character
    local newchar = morph

    newchar:SetPrimaryPartCFrame(oldchar.PrimaryPart.CFrame)

    player.Character = newchar
    newchar.Parent = workspace
end)

The print statement does work, and the only error I'm getting is: Character is not a valid member of Mouse "Instance"

I don't know what that error means. I never mentioned the mouse or used Instance.new in my code. Please, could someone help? I'm stuck.

0
dude same im having an issue like that but instead you click a gui to morph Agent_EpicNoob 71 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

Hi Try this code and see if it works, player is probably referring to mouse,

-- Put in a local script

local tool = script.Parent
local morph = tool:FindFirstChildOfClass("Model")
tool.Equipped:Connect(function(player)
    print("Works")
    local oldchar = game.Players.LocalPlayer.Character
    local newchar = morph

    newchar:SetPrimaryPartCFrame(oldchar.PrimaryPart.CFrame)

    newchar.Parent = workspace
    oldchar.Character = newchar
end)
0
@sne_123456 That code kind of works. There was one problem to it: you tried to find the character of a character (refer to lines 7 and 13). I fixed that and got no errors, but it still doesn't work. My character almost turns into the morph for a split second, then returns back to normal and the newchar goes back to where it last was. The tool is in StarterPack if that helps. zazazazazazazazaza21 0 — 3y
Ad

Answer this question