generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Problems in RemoteEvents.

Previous Thread :: Next Thread 
StickMasterNinja2 is not online. StickMasterNinja2
Joined: 18 May 2013
Total Posts: 1170
21 May 2015 06:55 PM
Script:

gun = script.Parent

local event1 = Instance.new("RemoteEvent")
event1.Parent = gun
event1.Name = "FireEvent"
event1.OnServerEvent:connect(function(player, mouse)
if mouse and gun.Equipped then
script.Parent.Handle.NormalFire:Play()
local hit = Instance.new("Part")
hit.Position = mouse.Hit.p
hit.Anchored = true
hit.CanCollide = false
hit.FormFactor = "Custom"
hit.Size = Vector3.new(0.2, 0.2, 0.2)
hit.TopSurface = "Smooth"
hit.BottomSurface = "Smooth"
hit.BrickColor = game.Players.LocalPlayer.TeamColor
hit.Material = "Metal"
hit.Name = "Bullet"
hit.Parent = game.Workspace

local damage = script.Parent.DamageScript:Clone()
damage.Disabled = false
damage.Parent = hit

local cleanup = script.Parent.BulletCleanup:Clone()
cleanup.Disabled = false
cleanup.Parent = hit
end
end)

local event2 = Instance.new("RemoteEvent")
event2.Parent = gun
event2.Name = "BombEvent"
event2.OnServerEvent:connect(function(player, mouse, key)
key = key:lower()
if key == "q" and gun.Equipped then
script.Parent.Handle.BombFire:play()

local bomb = Instance.new("Part")
bomb.Position = mouse.Hit.p
bomb.Anchored = true
bomb.FormFactor = "Custom"
bomb.Size = Vector3.new(0.2, 0.2, 0.2)
bomb.TopSurface = "Smooth"
bomb.BottomSurface = "Smooth"
bomb.BrickColor = game.Players.LocalPlayer.TeamColor
bomb.Material = "Metal"
bomb.Name = "Bomb"
bomb.Parent = game.Workspace

local prep = Instance.new("Sound")
prep.Parent = bomb
prep.Name = "PreparationSound"
prep.Volume = 0.5
prep.SoundId = "rbxassetid://138931042"

local boom = Instance.new("Sound")
boom.Parent = bomb
boom.Name = "ExplosionSound"
boom.Volume = 1
boom.SoundId = "rbxassetid://168208736"

local airhorn = script.Parent.AirhornBombScript:Clone()
airhorn.Disabled = false
airhorn.Parent = bomb
end
end)

Output:

20:16:55.943 - Players.Player1.Backpack.8Shooter.Events:10: attempt to index field 'Hit' (a nil value)
20:16:55.949 - Stack Begin
20:16:55.949 - Script 'Players.Player1.Backpack.8Shooter.Events', Line 10
20:16:55.949 - Stack End
20:16:56.373 - Players.Player1.Backpack.8Shooter.Events:36: attempt to index local 'key' (a nil value)
20:16:56.374 - Stack Begin
20:16:56.374 - Script 'Players.Player1.Backpack.8Shooter.Events', Line 36
20:16:56.374 - Stack End
Report Abuse
StickMasterNinja2 is not online. StickMasterNinja2
Joined: 18 May 2013
Total Posts: 1170
22 May 2015 04:33 PM
Bump.
Report Abuse
StickMasterNinja2 is not online. StickMasterNinja2
Joined: 18 May 2013
Total Posts: 1170
22 May 2015 05:48 PM
Please, I need help.
Report Abuse
nQqzRYVpIKA5jLP is not online. nQqzRYVpIKA5jLP
Joined: 05 Mar 2015
Total Posts: 4135
22 May 2015 05:50 PM
You can't use the mouse in a server script, idiot.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
22 May 2015 05:50 PM
No need to be a moron nQz...
Report Abuse
nQqzRYVpIKA5jLP is not online. nQqzRYVpIKA5jLP
Joined: 05 Mar 2015
Total Posts: 4135
22 May 2015 05:52 PM
There is always reason to be a moron.
Report Abuse
StickMasterNinja2 is not online. StickMasterNinja2
Joined: 18 May 2013
Total Posts: 1170
22 May 2015 05:53 PM
What would I use instead?
Report Abuse
nQqzRYVpIKA5jLP is not online. nQqzRYVpIKA5jLP
Joined: 05 Mar 2015
Total Posts: 4135
22 May 2015 05:56 PM
Just send the mouses position.
Report Abuse
StickMasterNinja2 is not online. StickMasterNinja2
Joined: 18 May 2013
Total Posts: 1170
22 May 2015 05:57 PM
What should I replace mouse.Hit.p?
Report Abuse
StickMasterNinja2 is not online. StickMasterNinja2
Joined: 18 May 2013
Total Posts: 1170
22 May 2015 06:13 PM
I put mouse.Position but it didn't work. The output says:

20:11:34.555 - Players.Player1.Backpack.8Shooter.Events:10: attempt to index local 'mouse' (a nil value)
20:11:34.555 - Stack Begin
20:11:34.556 - Script 'Players.Player1.Backpack.8Shooter.Events', Line 10
20:11:34.556 - Stack End
Report Abuse
StickMasterNinja2 is not online. StickMasterNinja2
Joined: 18 May 2013
Total Posts: 1170
22 May 2015 06:39 PM
Bump.
Report Abuse
StickMasterNinja2 is not online. StickMasterNinja2
Joined: 18 May 2013
Total Posts: 1170
22 May 2015 07:06 PM
Bump 2.
Report Abuse
nQqzRYVpIKA5jLP is not online. nQqzRYVpIKA5jLP
Joined: 05 Mar 2015
Total Posts: 4135
22 May 2015 07:10 PM
I said send the mouse's position.
Report Abuse
StickMasterNinja2 is not online. StickMasterNinja2
Joined: 18 May 2013
Total Posts: 1170
22 May 2015 07:14 PM
What I will write?
Report Abuse
nQqzRYVpIKA5jLP is not online. nQqzRYVpIKA5jLP
Joined: 05 Mar 2015
Total Posts: 4135
22 May 2015 07:18 PM
In the localscript, just send the mouse.Hit to the server.
Report Abuse
StickMasterNinja2 is not online. StickMasterNinja2
Joined: 18 May 2013
Total Posts: 1170
23 May 2015 09:45 AM
Another message on the output appeared:

11:45:27.521 - Players.Player1.Backpack.8Shooter.Events:10: attempt to index local 'mouse' (a nil value)
11:45:27.521 - Stack Begin
11:45:27.522 - Script 'Players.Player1.Backpack.8Shooter.Events', Line 10
11:45:27.522 - Stack End
Report Abuse
StickMasterNinja2 is not online. StickMasterNinja2
Joined: 18 May 2013
Total Posts: 1170
23 May 2015 10:27 AM
It's very important.
Report Abuse
Intern33t is not online. Intern33t
Joined: 19 Nov 2010
Total Posts: 1530
23 May 2015 10:31 AM
mouse is obviously freaking nil (not defined). you need to define it.

~ᵂʰᵒ ᵃʳᵉ ʸᵒᵘ ᵗᵒᵈᵃʸ﹖~
Report Abuse
rayk999 is not online. rayk999
Joined: 18 Feb 2011
Total Posts: 4705
23 May 2015 10:33 AM
You're attempting to get the mouse from a server script
and wat intern33t sed
Report Abuse
StickMasterNinja2 is not online. StickMasterNinja2
Joined: 18 May 2013
Total Posts: 1170
23 May 2015 10:35 AM
I don't know how to define it.
Report Abuse
NinjaFlamez is not online. NinjaFlamez
Joined: 03 Oct 2012
Total Posts: 132
23 May 2015 10:36 AM
is it in a local script?
Report Abuse
StickMasterNinja2 is not online. StickMasterNinja2
Joined: 18 May 2013
Total Posts: 1170
23 May 2015 10:43 AM
No, sorry.
Report Abuse
StickMasterNinja2 is not online. StickMasterNinja2
Joined: 18 May 2013
Total Posts: 1170
23 May 2015 11:08 AM
I thing I am going to cry.
Report Abuse
StickMasterNinja2 is not online. StickMasterNinja2
Joined: 18 May 2013
Total Posts: 1170
23 May 2015 11:41 AM
Bump.
Report Abuse
CrowClaws is not online. CrowClaws
Joined: 04 Jul 2010
Total Posts: 4466
23 May 2015 11:43 AM
this may to advance for youlol
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image