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

I cannot center a model in front of me, any help with CFrames?

Asked by 3 years ago

Hello! I have this script that spawns a model in front of me, an ice path. I tried anything, from using Vector3 and CFrames, but I am really bad at CFrames and think I am doing something wrong. Would anyone help me? This is how the part gets cloned as of now:

https://gyazo.com/6dde2221cc83052fceb7f491436b72be

This is the script:

game.ReplicatedStorage.RemoteEvents.IceSkill.IceFreeze.OnServerEvent:Connect(function(player)
    local character = player.Character
    if not character or not character.Parent then
        character = player.CharacterAdded:Wait()
    end

    local offset = Vector3.new(0,-4,0)
    local root = character.HumanoidRootPart

    local humanoid = character:WaitForChild("Humanoid")

    local ice = game.ReplicatedStorage.SkillsModels.Ice.IceFreeze:Clone()
    ice.Parent = workspace
    ice:MoveTo(root.Position-offset)

    local scripte = script.Script:Clone() --Script that copies within the model to hurt a player
    scripte.Parent = ice
    scripte.Disabled = false

    ice.Part.Sound:Play()

    wait(10)

    ice:Destroy()
end)

Answer this question