script.Parent.MouseButton1Click:connect(function() Player = script.Parent.Parent.Parent.Parent.Parent Character = game.Workspace:FindFirstChild(Player.Name) if Character ~= nil then Hum = Character:FindFirstChild("Humanoid") if Hum ~= nil then Hum.Jump = true local new = Instance.new('BodyVelocity') new.Name = "Vel" new.Parent = Character Character.Vel.Velocity.Y = 150 Character.Vel.Velocity.Z = 150 wait(10) new:Destroy() end end end)
the output says: 14:47:34.061 - Y cannot be assigned to
RicheeNektar is right: "Because the Velocity.(X/Y/Z) are READ only properties of the Velocity from the player that means you can only read their values and not set them. You need to set them with the Vector3.new()".
In addition, your script parented BodyVelocity to the player's character. It should be parented to one of the character's parts such as Torso. Try adding this:
new.Velocity = Vector3.new(0,150,150) new.Parent = Character.Torso
Notice that you can access the BodyVelocity's Velocity property directly since you established that the variable "new" is the new BodyVelocity. You need not find the velocity with "Character.Vel" each time.
Because the Velocity.(X/Y/Z) are READ only properties of the Velocity from the player that means you can only read their values and not set them. You need to set them with the Vector3.new() function Try this:
script.Parent.MouseButton1Click:connect(function() Player = script.Parent.Parent.Parent.Parent.Parent Character = game.Workspace:FindFirstChild(Player.Name) if Character ~= nil then Hum = Character:FindFirstChild("Humanoid") if Hum ~= nil then Hum.Jump = true local new = Instance.new('BodyVelocity') new.Name = "Vel" new.Parent = Character Character.Vel.Velocity = Vector3.new(0,150,150) wait(10) new:Destroy() end end end)