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

How do you get helmet on the head?

Asked by 7 years ago
Edited 7 years ago

So I've gotten a script, that clones the helmet onto the ground but it doesn't put it on the head. I've made a invisible head below the helmet so it knows where to put it. I'm not too sure on how to edit it though...

Heres the helmet model: https://www.roblox.com/library/921223663/unnamed

Thank you inadvance, btw this is script is from a button gui.

local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:wait()
local humanoid = char:WaitForChild("Humanoid")
local head = char:WaitForChild("Head")
head.Parent = char

local SS = game:GetService("ServerStorage")

script.Parent.MouseButton1Click:connect(function()
local hat = SS.NAME
hat:Clone().Parent = char
hat.CFrame = char.CFrame * CFrame.new(-7.8, 5.263, -19.7)
wait()
end)

1 answer

Log in to vote
0
Answered by 7 years ago

Well, I made this script, the hat should directly spawn on the players head..

local Character = game:GetService("Players").LocalPlayer.Character  -- get the character
script.Parent.MouseButton1Click:connect(function()  -- when parent is clicked... do the below
    local hat = ss:WaitForChild("NAME") -- a variable is created   "Name"  <-- the hat name
    if hat:WaitForChild("Handle") then -- finding the hats handle, all hats must have these..
        if Character:WaitForChild("Head") then  -- if the character has a head O.o
            local head = Character.Head -- variable  ^ needed because of players death issue
        end
        hat.Handle.Position = head.Position  -- hats position is now head position
    end
end

The hat should automatically go on the head..

Thanks for trying, greatneil80 (UNTESTED MAY NOT WORK)

Ad

Answer this question