Local hum = target.Parent:FindFirstChild("Humanoid") Handler : local re = script.Parent:WaitForChild("RemoteEvent") I need a solution for this since the game is inspired by The Walking Dead, if you needed to see the code it’s down below Plrgui:WaitForChild("HotBarGUI").So today i scripted a simple gun system but i have an issue with it, i am making it for a Survival game and Teamwork is needed for the game except my gun damages players in the same team. :Connect(function()Ĭlient.Character:WaitForChild("Humanoid").WalkSpeed = 17.5 Text.Text = (ammo)." / ".tostring(maxAmmo)ĬAS:BindAction("FireWeapon", GunHandler, true, 1, Enum.Ke圜ode.ButtonR2)ĬAS:BindAction("Reload", GunHandler, true, Enum.Ke圜ode.R, Enum.Ke圜ode.ButtonX)ĬAS:BindAction("WeaponZoom", GunHandler, true, 2, Enum.Ke圜ode.ButtonL2) lay(CoolDown, function() gunCooldown = false end)Įlseif ActionName = "FireWeapon" and BoolValue.Value and (table.find(FireTypes, inputObject.UserInputType) or table.find(FireTypes, inputObject.Ke圜ode)) and not reloading and not gunCooldown then If humanoid.Health 0 and not gunCooldown then Local humanoid = part.Parent:FindFirstChild("Humanoid") or :FindFirstChild("Humanoid") Local PlayerName = Instance.new("StringValue") Local bullet_clone = ServerStorage.Bullet:Clone()īullet_clone.Size = Vector3.new(0.1, 0.1, distance)īullet_clone.CFrame = CFrame.new(origin, intersection)*CFrame.new(0, 0, -distance/2) Local distance = (origin - intersection).Magnitude Local intersection = result and result.Position or origin + direction Local result = Workspace:Raycast(origin, direction) Local direction = (position - origin).Unit*300 Remote.OnServerEvent:Connect(function(player, position) Local ServerStorage = game:GetService("ServerStorage") Local Workspace = game:GetService("Workspace") Local remote = tool:WaitForChild("OnShoot") Local shoot_part = tool:WaitForChild("Handle") Server Script: local tool = script.Parent My gun will not make a bullet to where the mouse if pointing (sometimes), but let me know what you guys think. Hey developers, I made a custom gun script, and I want to check what you guys think.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |