of     1   

theCJarmy7
#183024067Friday, February 05, 2016 4:02 AM GMT

i have a script to make a part follow the mouse when a tool is equipped player = game.Players.LocalPlayer mouse = player:GetMouse() clicky = game.Workspace.placey tool = script.Parent local function onEquip() brick = Instance.new("Part",workspace) brick.BrickColor = BrickColor.new(1020) brick.Size = Vector3.new( .01, 4, 4) brick.Shape = "Cylinder" brick.Anchored = true mouse.TargetFilter = brick mouse.Move:connect(function() if mouse.Hit then brick.CFrame = mouse.Hit brick.Rotation = Vector3.new(0,0,-90) end end) end tool.Equipped:connect(onEquip) if i take off the onEquip part, it works fine, but it never goes away. i want it to go away when i unequip the tool. any idea whats up with this?
Hedr0n
#183024615Friday, February 05, 2016 4:11 AM GMT

i have a script to make a part follow the mouse when a tool is equipped player = game.Players.LocalPlayer mouse = player:GetMouse() clicky = game.Workspace.placey tool = script.Parent local event local function onEquip() brick = Instance.new("Part",workspace) brick.BrickColor = BrickColor.new(1020) brick.Size = Vector3.new( .01, 4, 4) brick.Shape = "Cylinder" brick.Anchored = true mouse.TargetFilter = brick event = mouse.Move:connect(function() if mouse.Hit then brick.CFrame = mouse.Hit brick.Rotation = Vector3.new(0,0,-90) end end) end tool.Equipped:connect(onEquip) tool.Uneqipped:connect(function() event:Disconnect() event = nil end Gotta clean up your events boyo
theCJarmy7
#183025509Friday, February 05, 2016 4:29 AM GMT

didnt work, nothing was in the output
Hedr0n
#183025693Friday, February 05, 2016 4:32 AM GMT

Make sure unequivocal is a actual event.
theCJarmy7
#183025734Friday, February 05, 2016 4:33 AM GMT

unequivocal?what?
cooknunit
#183029538Friday, February 05, 2016 6:16 AM GMT

Hmm... Wiki kinda sucks when it comes to mouse documentation. However, I got the following to work by putting a Tool in the StarterPack, inserted a Part under Tool, made it invisible, called it Handle, put a LocalScript under the Tool, inserted the following code: player = game.Players.LocalPlayer mouse = player:GetMouse() --clicky = game.Workspace.placey tool = script.Parent local function onEquip() brick = Instance.new("Part",workspace) brick.BrickColor = BrickColor.new(1020) brick.Size = Vector3.new( .01, 4, 4) brick.Shape = "Cylinder" brick.Anchored = true mouse.TargetFilter = brick mouse.Move:connect(function() if mouse then brick.CFrame = CFrame.new(mouse.Hit.X, mouse.Hit.Y, mouse.Hit.Z) brick.Rotation = Vector3.new(0,0,-90) end end) end tool.Equipped:connect(onEquip) tool.Unequipped:connect(function() brick:Destroy() end)
theCJarmy7
#183055451Friday, February 05, 2016 10:19 PM GMT

i did what you did, it said in the output Equipped is not a valid member of Part 14:13:45.629 - Script 'Players.Player.Backpack.Tool.Handle.LocalScript', Line 23 14:13:45.629 - Stack End i put Script.Parent.Parent for the tool, and it worked. it did send the player to some weird coords, (i think it was 0,0,0) anyway to make the player stay in the current position when they select the tool. it only happens the first time the player selects the tool. but after you die, you get teleported after holding the tool.
cooknunit
#183060432Friday, February 05, 2016 11:48 PM GMT

Make sure you have your LocalScript under the "Tool". Put a "print(tool.Name) after you set "tool = script.Parent". If it doesn't output "Tool" or whatever you named the Tool then it won't work. The error looks like the LocalScript is under the Handle.
theCJarmy7
#183061328Saturday, February 06, 2016 12:02 AM GMT

thanks a ton, it works!
theCJarmy7
#183061698Saturday, February 06, 2016 12:09 AM GMT

wait, scratch that. it still teleports me the first time i select the tool.
theCJarmy7
#183064491Saturday, February 06, 2016 12:52 AM GMT

bump
theCJarmy7
#183067884Saturday, February 06, 2016 1:47 AM GMT

bump again
cooknunit
#183071926Saturday, February 06, 2016 2:49 AM GMT

Not sure why you would teleport... I did find a bug in the code I gave you: brick = Instance.new("Part",workspace) Should be: brick = Instance.new("Part", game.Workspace)

    of     1