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

My Dart Gun Script has server-client communication issues. How can I fix this?

Asked by 5 years ago

I am currently building a Nerf Gun FPS. I am currently struggling with communication between server and client. My goal is to spawn a dart using a server script and remote functions. Script is below:

01--Main Script which goes in Server Storage --
02 
03 
04local serverStorage = game:GetService("ServerStorage")
05local replicatedStorage = game:GetService("ReplicatedStorage")
06local KOValue = "Kills"
07local WOValue = "Wipeouts"
08local damage = 30
09replicatedStorage.ShootEvent.OnServerEvent:Connect(function(player,tool,position,part)
10    if game.Workspace[player.Name].Humanoid.Health <= 0 then
11        -- The player is dead, do not do anything
12    else
13 
14-- Create a clone of Dart and set its color
15local Dart = 
View all 90 lines...

Local Script Below:

001--Constraints
002local IgnoreList = {rocket = 0, handle = 1, effect = 1, water = 1} -- Rocket will fly through things named these
003--NOTE: Keys must be lowercase, values must evaluate to true
004--Variables
005local tool = script.Parent
006 
007local player = game.GetService("Players").LocalPlayer
008 
009local mouse = player:GetMouse()
010 
011 
012local gungui = tool:WaitForChild("GunGUI" )
013local firesound = tool.WaitForChild("FireSound")
014local reloadsound = tool.WaitForChild("ReloadSound")
015local primesound = tool.WaitForChild("PrimeSound")
View all 171 lines...
0
Server scripts should go into ServerScriptService, and the remote events inside of ReplicatedStorage. Nowaha 459 — 5y
0
Please specify your issue and where the issue is in your code. Honestly, nobody feels like trying to understand over 200 lines of another person's unknown code without understanding what the issue even is exactly. Nowaha 459 — 5y
0
I didn't think so ExHydraboy 30 — 5y
0
My problem is this. I had an original script that simply fired the dart. I used a few YT vids to make it create remote functions on tool equip but It didn't do much else. Recently I have tried to rewrite the script and add some animations and a HUD, but the original script is confusing me. ExHydraboy 30 — 5y
0
Originally I had a local script that I copied from somewhere that made the tool mobile compatible, and the setup was a Script inside of a Local script with no server scripts. I've never been good with scripting tools, but online it said to use Remote Functions and Server scripts. In the server script on lines 14 - 47 I have the main dart mesh. I'm confused on where to put it. ExHydraboy 30 — 5y

Answer this question