topcst
|
  |
| Joined: 20 Dec 2011 |
| Total Posts: 3052 |
|
|
| 05 Jan 2017 04:51 PM |
Output says this, but idk how to fix, Help would be nice
'GetMouse is not a valid member of Backpack' 'Script 'Players.Player1.Backpack.Fireball.Script', Line 3'
local Tool = script.Parent play = script.Parent.Parent mouse = play:GetMouse() char = play.Character hum = char.Humanoid
local en = true Tool.RemoteEvent.OnServerEvent:connect(function(play,mousehit) hum.LoadAnimation(Tool.Throw):Play() wait(0.5) local fireball = Tool.Handle:clone() fireball.CFrame = Tool.Handle.CFrame local bv = Instance.new("BodyVelocity") bv.MaxForce = Vector3.new(1e8,1e8,1e8) bv.Velocity = mousehit.lookVector * 50 bv.Parent = fireball fireball.CanCollide = false fireball.Parent = game.Workspace end)
#thatsnotmeyeahiusedtoweargucci |
|
|
| Report Abuse |
|
|
DJ3KJ
|
  |
| Joined: 19 Dec 2015 |
| Total Posts: 207 |
|
|
| 05 Jan 2017 05:05 PM |
I can help you fix if you can tell me what GetMouse is supposed to do. Do you mean touch? Hit? GetMouse according to you is a function.
|
|
|
| Report Abuse |
|
|
topcst
|
  |
| Joined: 20 Dec 2011 |
| Total Posts: 3052 |
|
|
| 05 Jan 2017 05:08 PM |
Its supposed to find where your mouse is clicking, then throw a fireball wherever the mouse click is,
#thatsnotmeyeahiusedtoweargucci |
|
|
| Report Abuse |
|
|
|
| 05 Jan 2017 05:09 PM |
You're trying to call GetMouse() on the player's backpack object.
This should work:
play = script.Parent.Parent.Parent --One more parent from Backpack is Player. mouse = play:GetMouse() |
|
|
| Report Abuse |
|
|
DJ3KJ
|
  |
| Joined: 19 Dec 2015 |
| Total Posts: 207 |
|
|
| 05 Jan 2017 05:10 PM |
My final question before I can help you is, is this a localscript, a script, or what is it? Also depends on what the parent is
|
|
|
| Report Abuse |
|
|
topcst
|
  |
| Joined: 20 Dec 2011 |
| Total Posts: 3052 |
|
|
| 05 Jan 2017 05:16 PM |
Intended, Players.Player1.Backpack.Fireball.LocalScript:3: attempt to index global 'play' (a nil value) shows up when i edit the code to as you said.
DJ3, this is a script the parent its looking for is the player so the script is going script>tool>player well it is now it was by accident script>tool but it still doesnt work
#thatsnotmeyeahiusedtoweargucci |
|
|
| Report Abuse |
|
|
topcst
|
  |
| Joined: 20 Dec 2011 |
| Total Posts: 3052 |
|
|
| 05 Jan 2017 05:18 PM |
Nvm it shows this now 'GetMouse is not a valid member of DataModel'
#thatsnotmeyeahiusedtoweargucci |
|
|
| Report Abuse |
|
|
|
| 05 Jan 2017 05:19 PM |
Ok make sure this is a local script:
local Tool = script.Parent play = game.Players.LocalPlayer mouse = play:GetMouse() char = play.Character hum = char.Humanoid
local en = true Tool.RemoteEvent.OnServerEvent:connect(function(play,mousehit) hum.LoadAnimation(Tool.Throw):Play() wait(0.5) local fireball = Tool.Handle:clone() fireball.CFrame = Tool.Handle.CFrame local bv = Instance.new("BodyVelocity") bv.MaxForce = Vector3.new(1e8,1e8,1e8) bv.Velocity = mousehit.lookVector * 50 bv.Parent = fireball fireball.CanCollide = false fireball.Parent = game.Workspace
end)
|
|
|
| Report Abuse |
|
|
tbnj123
|
  |
| Joined: 29 Oct 2010 |
| Total Posts: 443 |
|
|
| 05 Jan 2017 05:20 PM |
| game.Players.LocalPlayer:GetMouse() |
|
|
| Report Abuse |
|
|
topcst
|
  |
| Joined: 20 Dec 2011 |
| Total Posts: 3052 |
|
|
| 05 Jan 2017 05:26 PM |
Thanks, but the animation doesnt work saying the Fireball is not a valid member of Player
#thatsnotmeyeahiusedtoweargucci |
|
|
| Report Abuse |
|
|
topcst
|
  |
| Joined: 20 Dec 2011 |
| Total Posts: 3052 |
|
|
| 05 Jan 2017 05:28 PM |
nvm fixed its called tool not fireball
#thatsnotmeyeahiusedtoweargucci |
|
|
| Report Abuse |
|
|
DJ3KJ
|
  |
| Joined: 19 Dec 2015 |
| Total Posts: 207 |
|
|
| 05 Jan 2017 05:37 PM |
Try this: function GetMouse()
local Tool = script.Parent play = script.Parent.Parent mouse = play:GetMouse() char = play.Character hum = char.Humanoid extrhum = game.Workspace.GetChildren()
local en = true Tool.RemoteEvent.OnServerEvent:connect(function(play,mousehit) hum.LoadAnimation(Tool.Throw):Play() wait(0.5) local fireball = Tool.Handle:clone() fireball.CFrame = Tool.Handle.CFrame local bv = Instance.new("BodyVelocity") bv.MaxForce = Vector3.new(1e8,1e8,1e8) bv.Velocity = mousehit.lookVector * 50 bv.Parent = fireball fireball.CanCollide = false fireball.Parent = game.Workspace
end end)
|
|
|
| Report Abuse |
|
|
DJ3KJ
|
  |
| Joined: 19 Dec 2015 |
| Total Posts: 207 |
|
| |
|