|
| 20 Oct 2014 07:17 PM |
I don't get what this error means... the script worked before I added the lucky block portion. halp plox Script:
function onButton1Down(mouse) print(game.Workspace[script.Parent.Parent.Parent.Name]) posp = game.Workspace[script.Parent.Parent.Parent.Name].Head.Position local ray = Ray.new(game.Workspace[script.Parent.Parent.Parent.Name].Head.Position, mouse.Hit.p) local hit, position = game.Workspace:FindPartOnRay(ray, game.Workspace[script.Parent.Parent.Parent.Name])
--do damage to any humanoids hit local humanoid = hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") --draw the ray local distance = (position - posp).magnitude local rayPart = Instance.new("Part", game.Workspace) rayPart.Name = "RayPart" rayPart.BrickColor = BrickColor.new("Bright red") rayPart.Transparency = 0.5 rayPart.Anchored = true rayPart.CanCollide = false rayPart.TopSurface = Enum.SurfaceType.Smooth rayPart.BottomSurface = Enum.SurfaceType.Smooth rayPart.formFactor = Enum.FormFactor.Custom rayPart.Size = Vector3.new(0.2, 0.2, distance) rayPart.CFrame = CFrame.new(position, posp) * CFrame.new(0, 0, -distance/2) game.Debris:AddItem(rayPart, 0.1) if hit == nil then elseif game.Workspace[hit.Name].type ~= nil and hit.Name:gsub(hit.Name:sub(1,4),"") == "Turbo" then print("plane hit") game.Workspace.explode:play() -- game.Workspace[hit.Name].Position = Vector3.new(-68, 12, -43.5) game.Workspace[hit.Name]:remove() -- print(game.Workspace[hit.Name].Position) local h = Instance.new("Hint", game.Players[script.Parent.Parent.Parent.Name].PlayerGui) text = " "..hit.Name:gsub(hit.Name:sub(1,4), "").." destroyed." for i = 1, #text do h.Text = text:sub(i) wait(.1) end h:remove() elseif game.Workspace[hit.Name].placer then local h = Instance.new("Hint", game.Players[script.Parent.Parent.Parent.Name].PlayerGui) text = " Lucky Block Opened." for i = 1, #text do h.Text = text:sub(i) wait(.1) end h:remove() end
end function onSelected(mouse) mouse.Button1Down:connect(function() onButton1Down(mouse) end) end script.Parent.Selected:connect(onSelected)
ERROR: Head is not a valid member of Workspace
Thank you... I suck at scripting e.e
~ quarter monkey, quarter potato, half memorycode. |
|
|
| Report Abuse |
|
|
|
| 20 Oct 2014 08:01 PM |
bermp.
I also have to add that the rest of the script works but when I hit the "lucky block" it breaks. |
|
|
| Report Abuse |
|
|
|
| 21 Oct 2014 01:49 PM |
| bumpbumpbump shake your bump |
|
|
| Report Abuse |
|
|
|
| 21 Oct 2014 02:26 PM |
not sure, but could this be a bug? sometimes i got an error with a model, not being inside a model... when it was ;/ |
|
|
| Report Abuse |
|
|
anaIyze
|
  |
| Joined: 29 May 2014 |
| Total Posts: 2048 |
|
|
| 21 Oct 2014 02:45 PM |
'posp = game.Workspace[script.Parent.Parent.Parent.Name].Head.Position' 'game.Workspace[script.Parent.Parent.Parent.Name].Head.Position' '[script.Parent.Parent.Parent.Name].Head.Position' '[script.Parent.Parent.Parent`.Name`].Head' '.Name'
Lol |
|
|
| Report Abuse |
|
|
|
| 21 Oct 2014 06:08 PM |
What about it??
That shouldn't error the code... it works for the other elseif statements.
|
|
|
| Report Abuse |
|
|
jr41901
|
  |
| Joined: 03 Mar 2013 |
| Total Posts: 35 |
|
|
| 21 Oct 2014 06:31 PM |
| wouldent the head be a part of the players model and not a child of workspace? |
|
|
| Report Abuse |
|
|
|
| 21 Oct 2014 06:57 PM |
game.Workspace[hit.Name]
All of the lines that say this to find the head should be
game.Workspace[hit.Parent.Name]
just make sure there wont be anything with the same name as a player in workspace |
|
|
| Report Abuse |
|
|