Hello I am working on a murder mystery style game and as we all know a game like that requires weapons…
I got my weapons that are going to be used in replicated storage in a folder called Items each weapons has a main handle and than the model itself as shown in this picture
right now i have a server script called DamageHandler which manages the killing aspect of the knife and than I have a local script called KnifeHandler which manages when the knife is equipped/unequipped and also when a player uses it as well as a RemoteEvent called “StabEvent” but with all the knifes I have in my game it’s kind of a pain to use the same two scripts and paste them into each knife
I understand that games like assassin use a module script that holds the ( name, imageID, rarity, color) to sort out the information of each knife
what im getting at is I am trying to make a system similar to assassin but I am not too sure how to come about this
here are the current scripts
Knife Handler (local script)
local HoldAnim = game.ReplicatedStorage.Animations:WaitForChild("Hold_Animation")
local ThrowAnim = game.ReplicatedStorage.Animations:WaitForChild("Throw_Animation")
local StabAnim = game.ReplicatedStorage.Animations:WaitForChild("Stab_Animation")
local ThrowSound = game.ReplicatedStorage.Sounds:WaitForChild("Knife_Throw")
local StabSound = game.ReplicatedStorage.Sounds:WaitForChild("Knife_Slash")
local Knife = script.Parent
local MouseService = game:GetService("MouseService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local plrMouse = player:GetMouse()
local StabEvent = game.ReplicatedStorage.Remotes:WaitForChild("Stab")
Knife.Equipped:Connect(function()
local HoldTrack = script.Parent.Parent.Humanoid:LoadAnimation(HoldAnim)
HoldTrack:Play()
Knife.Unequipped:Connect(function()
HoldTrack:Stop()
end)
end)
Knife.Activated:Connect(function()
local StabTrack = script.Parent.Parent.Humanoid:LoadAnimation(StabAnim)
StabTrack:Play()
StabSound:Play()
task.wait(1)
StabEvent:FireServer()
end)```
Damage Handler (Server Script)
local CanStab = true
local StabEvent = game.ReplicatedStorage.Remotes:WaitForChild("Stab")
local DebounceTable = {}
local HoldingAnim = game.ReplicatedStorage.Animations:WaitForChild("Stab_Animation")
local hitbox = script.Parent:WaitForChild("Hitbox")
StabEvent.OnServerEvent:Connect(function()
script.Parent:WaitForChild("Hitbox").Touched:Connect(function(objectThatTouchesTheHitbox)
if objectThatTouchesTheHitbox.Parent then
if objectThatTouchesTheHitbox.Parent:FindFirstChild("Humanoid") then
if DebounceTable[objectThatTouchesTheHitbox.Parent] == true then return end
DebounceTable[objectThatTouchesTheHitbox.Parent] = true
objectThatTouchesTheHitbox.Parent.Humanoid:TakeDamage(100)
print("Knife Hit: ".. objectThatTouchesTheHitbox.Parent.Name)
task.wait(0.5)
DebounceTable[objectThatTouchesTheHitbox.Parent] = nil
end
end
end)
end)
any help or advice would be much appreciated
