I have tried hard to get this to work and this is the closest i could get. So here are my scripts
Under starterpack Weight(tool called) and under it a Local script
local module = require(script.Parent:WaitForChild("ModuleScript")) local player = game.Players.LocalPlayer local mouse = player:GetMouse() script.Parent.Activated:Connect(function() module.Lift() print "ok" end)
and module script
local module = {} local replicatedStorage = game:GetService("ReplicatedStorage") function module.Lift() replicatedStorage.Remotes.Lift:FireServer() end return module
under serverscriptservice script(Remotes)
local replicatedStorage = game:GetService("ReplicatedStorage") local remoteData = game:GetService("ServerStorage"):WaitForChild("RemoteData") local cooldown = 1 replicatedStorage.Remotes.Lift.OnServerEvent:Connect(function(player) print("FIRED") if not remoteData:FindFirstChild(player.Name) then return "NoFolder" end print ("got past it statement") local debounce = remoteData(player.Name).Debounce if not debounce.Value then print("if statement is ok") debounce.Value = true player.leaderstats.Strength.Value = player.leaderstats.Strength.Value + 25 wait(cooldown) debounce.Value = false end end)
also under serverscriptservice script(Stats)
local serverStorage = game:GetService("ServerStorage") game.Players.PlayerAdded:Connect(function(player) local leaderstats = Instance.new("Folder") leaderstats.Name = "leaderstats" leaderstats.Parent = player local strength = Instance.new("NumberValue") strength.Name = "Strength" strength.Parent = leaderstats local dataFolder = Instance.new("Folder") dataFolder.Name = player.Name dataFolder.Parent = serverStorage.RemoteData local debounce = Instance.new("BoolValue") debounce.Name = "Debounce" debounce.Parent = dataFolder end)
under serverstorage a folder(RemoteData)