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

Floating brick on head????

Asked by 10 years ago

I cant script so i edited a hat script... but it dont work.. I have a brick called "Handle" i want is when player enters it will be on their head floating...

X = script.Parent
game.Players.PlayerAdded:connect(onPlayerRespawned)
function onPlayerRespawned(newPlayer)
    wait(1)
Parent:FindFirstChild("Humanoid")
I = Instance.new("Hat")
I.Parent = Parent
I.AttachmentForward = Vector3.new(-0,-0,-1) --Change this to the AttachmentForward of the hat.
I.AttachmentPos = Vector3.new(0,-2,0.155) --Change this to the AttachmentPos of the hat.
I.AttachmentRight = Vector3.new(1,0,0) --Change this to the AttachmentRight of the hat.
I.AttachmentUp = Vector3.new(0,5,0) --Change this to the AttachmentUp of the that.
I.Name = "Handle" --Change this to the ingame name of the hat.
C = script.Parent:clone()
C.Parent = I
end
function onPlayerEntered(newPlayer)
    newPlayer.Changed:connect(function (property)
        if (property == "Character") then
            onPlayerRespawned(newPlayer)
        end
    end)
end

game.Players.PlayerAdded:connect(onPlayerEntered)

1 answer

Log in to vote
0
Answered by 10 years ago

Sorry if this doesn't work.

LocalScript Required.

wait(0)

local plr = game:service("Players").LocalPlayer

repeat wait(0)until plr.Character

local find = script:FindFirstChild("Handle")
if find ~=nil then
sbbu = script.Handle:clone()
else
print("Handle doesn't exist, your script may not work right")
end

function makehat(Parent)
local sbbu = script.Handle:clone()
I = Instance.new("Hat")
I.Parent = Parent
I.AttachmentForward = Vector3.new(-0,-0,-1) --Change this to the AttachmentForward of the hat.
I.AttachmentPos = Vector3.new(0,-2,0.155) --Change this to the AttachmentPos of the hat.
I.AttachmentRight = Vector3.new(1,0,0) --Change this to the AttachmentRight of the hat.
I.AttachmentUp = Vector3.new(0,5,0) --Change this to the AttachmentUp of the that.
I.Name = "Handle" --Change this to the ingame name of the hat.
sbbu.Parent = I
end

makehat(plr.Character)
Ad

Answer this question