Hi there, I want that in my game players are not the standard character model I want that players are rolls. what is wrong with my script that the player can not roll over the baseplate like I want it to be??
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local hrp = character:WaitForChild("HumanoidRootPart")
-- Entferne Standard-Charakterteile
for _, part in pairs(character:GetChildren()) do
if part:IsA("BasePart") and part.Name ~= "HumanoidRootPart" then
part.Transparency = 1
part.CanCollide = false
end
end
-- Erstelle den Zylinder
local cylinder = Instance.new("Part")
cylinder.Shape = Enum.PartType.Cylinder
cylinder.Size = Vector3.new(4, 2, 4) -- Startgröße des Zylinders
cylinder.Anchored = false
cylinder.CanCollide = false
cylinder.Material = Enum.Material.SmoothPlastic
cylinder.BrickColor = BrickColor.new("Bright blue")
cylinder.Parent = character
cylinder.CFrame = hrp.CFrame
-- Synchronisiere Zylinder mit HumanoidRootPart
game:GetService("RunService").RenderStepped:Connect(function()
cylinder.CFrame = hrp.CFrame
end)
-- Steuerung für Bewegung
local speed = 16 -- Bewegungsgeschwindigkeit
local moveDirection = Vector3.zero
local UserInputService = game:GetService("UserInputService")
UserInputService.InputBegan:Connect(function(input, gameProcessed)
if gameProcessed then return end
if input.KeyCode == Enum.KeyCode.W then
moveDirection += Vector3.new(0, 0, -1)
elseif input.KeyCode == Enum.KeyCode.S then
moveDirection += Vector3.new(0, 0, 1)
elseif input.KeyCode == Enum.KeyCode.A then
moveDirection += Vector3.new(-1, 0, 0)
elseif input.KeyCode == Enum.KeyCode.D then
moveDirection += Vector3.new(1, 0, 0)
end
end)
UserInputService.InputEnded:Connect(function(input)
if input.KeyCode == Enum.KeyCode.W or input.KeyCode == Enum.KeyCode.S then
moveDirection = Vector3.new(moveDirection.X, 0, 0)
elseif input.KeyCode == Enum.KeyCode.A or input.KeyCode == Enum.KeyCode.D then
moveDirection = Vector3.new(0, 0, moveDirection.Z)
end
end)
game:GetService("RunService").RenderStepped:Connect(function(deltaTime)
local velocity = moveDirection * speed * deltaTime
hrp.CFrame = hrp.CFrame + velocity
end)