Hi, so I have a RemoveEvent setup so that when someone swings a sword (any sword) it will give them +25xp. However, I am trying to make each sword give a different amount. So Sword A will give +25 per swing, and Sword B will give +50 per swing etc.
Script inside ServerScriptService:
local replicatedStorage = game:GetService("ReplicatedStorage") local remoteData = game:GetService("ServerStorage"):WaitForChild("RemoteData") local cooldown = 0.85 replicatedStorage.Remotes.Swing.OnServerEvent:Connect(function(player) if not remoteData:FindFirstChild(player.Name) then return "NoFolder" end local debounce = remoteData[player.Name].Debounce if not debounce.Value then debounce.Value = true player.leaderstats.XP.Value = player.leaderstats.XP.Value + 25 player.leaderstats["Strength"].Value = player.leaderstats["Strength"].Value + 25 wait(cooldown) debounce.Value = false end end)
This is the ModuleScript inside the all the swords I have so far:
local module = {} local replicatedStorage = game:GetService("ReplicatedStorage") function module.Swing() replicatedStorage.Remotes.Swing:FireServer() end return module
and here is the LocalScript I have inside all the swords I have so far:
local module = require(script.Parent:WaitForChild("ModuleScript")) local player = game.Players.LocalPlayer local mouse = player:GetMouse() script.Parent.Activated:Connect(function() module.Swing() end)
Do I have to make different swing events for all the different swords?
Or is there a better method I could use here?
Thanks!