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

Why is this bullet script not running for 3 seconds online?

Asked by
DanDev 0
10 years ago

I've made a gun with the shooting based of the ROBLOX paintball gun. A script with a touched event is added to every fired bullet. In solo it works fine but online the bullet script takes 2-3 seconds to respond.

The gun's shooting:

   local bullet = game.ReplicatedStorage.Bullet:Clone()
   bullet.Anchored=false
   bullet.CFrame = CFrame.new(spawnPos, targetPos)
   bullet.Velocity = v * 380
   local damage = Instance.new("NumberValue", bullet)
   damage.Name="Damage"
   damage.Value=(game.ReplicatedStorage.Items[thisMag.Name].Damage.Value)

   local force = Instance.new("BodyForce")
   force.force = Vector3.new(0,bullet:GetMass()*192.6,0)
   force.Parent = bullet

   local ownerTag=game.ReplicatedStorage['pvptag']:Clone()
   ownerTag.Value=plr
   ownerTag.Parent=bullet

   local bulletScript = game.ReplicatedStorage.Scripts['BulletScript']:Clone()
   bulletScript.Parent=bullet
   bulletScript.Disabled=false

   print(bullet,bullet.Parent, bulletScript,bulletScript.Parent)
   bullet.Parent=workspace

Script inside bullet

print("BULLET SCRIPT INIT") --takes 2-3 seconds after firing to print this

script.Parent.Touched:connect(function(p)
   print(p:GetFullName())   
end)
0
Is the bullet script (the one loacted in ReplicatedStorage.Scripts) a normal script? User#2 0 — 10y
0
The bullet script is a normal script, it run online after 3 seconds in workspace. DanDev 0 — 10y

Answer this question