Working on a trash-gun, simple concept it fling’s trash AND if the trash hits a player it softly flings them.
How would I go about doing this?
Here’s my gun-handler (server)
-- // Constants \\ --
local Tool = script.Parent
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Framework = ReplicatedStorage:WaitForChild("Framework")
local Throwables = Framework:WaitForChild("Throwables")
local ThrowablesItems = Throwables:GetChildren()
local Events = script.Parent.Client.Events
local Animations = script.Parent.Client.Animations
local Sounds = script.Parent.Client.Sounds
Events.FireEvent.OnServerInvoke = function(Player: Player, TrashType: string)
local Trash = Instance.new('Part',workspace)
Trash.CFrame = Player.Character.HumanoidRootPart.CFrame + (Player.Character.HumanoidRootPart.CFrame.LookVector * 5) -- // Teleport part in-front of player, now we need to fling it
end
-- // TrashType will be used at a later date...