Hi everybody!
What I’m trying to achieve is as soon as the player flies that he changes character! What I have now is that if the player presses F then you fly and that works perfectly.
I know that as soon as I place a StarterCharacter in starterplayer it will automatically change to that character but I only want this to happen when I press F and the player flies.
The flying character is actually a kind of light ball. And now have the flying character transparent arms, legs, torso and head. so my question is does a character have to have a specific head, legs and arms or can I just use Torso or HumanoidRootPart without the head,leg and arms?
Unfortunately I’m not good at programming yet and would therefore like your help!
This here below is my simple fly script:
repeat wait() until game.Players.LocalPlayer.Character
local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local torso = character:WaitForChild("LowerTorso")
local mouse = player:GetMouse()
local enabled = false
mouse.KeyDown:Connect(function(key)
if key == "f" then
if enabled == false then
enabled = true
local bodyvelocity = Instance.new("BodyVelocity", torso)
bodyvelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
while enabled == true do
bodyvelocity.Velocity = mouse.Hit.LookVector * 100
wait()
end
end
if enabled == true then
enabled = false
torso:FindFirstChild("BodyVelocity"):Destroy()
end
end
end)
Thank you! So now I have a nice character that I want to change if the player is flying. How can I change the character? So as I told I only want to change it when the player is pressing F
I believe loadcharacter might help you with that although I do suggest taking a look at some ‘shop tutorials’ they’ll show how to load a character into a customized one! I haven’t done this but I know mandatory requirements lol sorry!
Unfortunately I can’t find anything how to change it.
I even looked at animations to see if they could do something with it, but that doesn’t work.
So what I have is the main character that looks like your own character. And if someone is pressing F the player starts flying. And I want to change the players character to a specific character what looks like a glowing light
I believe you can manually set the player’s character to a new character model, effectively changing their appearance. This has to be done on the server, and you’ll have to set the camera’s subject to the new character model, but it should work.
I’m looking on the internet and youtube for the solution, without success. Hopefully did someone else this and could help me. In the meantime I will keep searching for a solution. p.s. I saw something about “HumanoidDescription”? Maybe is this the solution?
mouse.KeyDown:Connect(function(key)
if key == "f" then
if enabled == false then
enabled = true
local bodyvelocity = Instance.new("BodyVelocity", torso)
bodyvelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
while enabled == true do
character = game.Workspace.StarterCharacter:Clone()
workspace.CurrentCamera.CameraSubject = humanoid
bodyvelocity.Velocity = mouse.Hit.LookVector * 100
wait()
end
end
it wont change the character.
Then what I tried was first above
character = game.Workspace.StarterCharacter:Clone()
to first Destroy() the Character but then I cant move and get a error message
Player:Move called, but player currently has no humanoid. (x45) - Studio
So what am I doing wrong? (the StarterCharacter has humanoid and humanoidrootpart in it)
local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local torso = character:WaitForChild("LowerTorso")
local mouse = player:GetMouse()
local enabled = false
mouse.KeyDown:Connect(function(key)
if key == "f" then
if enabled == false then
enabled = true
local bodyvelocity = Instance.new("BodyVelocity", torso)
bodyvelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
while enabled == true do
character:Destroy()
character = game.Workspace.StarterCharacter:Clone()
workspace.CurrentCamera.CameraSubject = humanoid
bodyvelocity.Velocity = mouse.Hit.LookVector * 100
wait()
end
end
You’re only setting the variable. You need to explicitly set player.Character = game.Workspace.StarterCharacter
In your case here, doing character = StarterCharacter is setting the variable you created in the script, while what you need to do is set the player’s character property directly.
mouse.KeyDown:Connect(function(key)
if key == "f" then
if enabled == false then
enabled = true
local bodyvelocity = Instance.new("BodyVelocity", torso)
bodyvelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
while enabled == true do
player.Character = game.Workspace.StarterCharacter:Clone()
workspace.CurrentCamera.CameraSubject = humanoid
bodyvelocity.Velocity = mouse.Hit.LookVector * 100
wait()
end
end
Only problem now is that it wont give me any errors. But the camera is broken as you said and after 2 sec the player respawned (probably because of no head/body)
I used your code but then every half sec the newcharacter spawns in with like 300 characters,
while enabled == true do
local newCharacter = workspace.StarterCharacter:Clone()
newCharacter.Parent = workspace
player.Character = newCharacter
workspace.CurrentCamera.CameraSubject = newCharacter.Humanoid
bodyvelocity.Velocity = mouse.Hit.LookVector * 100
wait()
end
The only reason why the character needs to change is because the player can fly.
After pressing F again the the fly character needs to change with the old one…