Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Doesn't give Drink Points in leaderstats when i click the tool, why?

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

    local debounce = remoteData[player.Name].Debounce

    if not debounce.Value then

        debounce.Value = true

        player.leaderstats.drinkpoints.Value = player.leaderstats.drinkpoints.Value + 25 * (player.leaderstats.Rebirths.Value + 1)

        wait(cooldown)

        debounce.Value = false

    end

end)

This is the source above, so I need help for this, actually if you want more information please help me at discord: DrBread#1958

5 comments

0

Does "Fired" print? Is this a server script.

0

This is a duplicated of your prev post. Please update your prev post and remove this one.

0

Fired not prints, and its in ServerScriptService

0

Are you using FireServer from a local script within the tool? Add your tool's script.

0

Below..

2 answers

LocalScript in Tool:

local module = require(script.Parent:WaitForChild("ModuleScript"))
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

script.Parent.Activated:Connect(function()
	module.Lift()
end)

Module Script in tool:

local module = {}
local replicatedStorage = game.GetService("ReplicatedStorage")

function module.Lift()
	
	replicatedStorage.Remotes.Lift:FireServer()
end

return module

And yes i have a folder in it RemoteEvent called Lift

2 comments

0

Why are you using a modulescript when you could just FireServer directly from the localscript?

0

Because it's from alvinbloxx's "How to make a simulator game" tutorial. This is for asking help on your own script

Do not fire a remote event from the module script, fire it from the localScript..

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

script.Parent.Activated:Connect(function()
	replicatedStorage.Remotes.Lift:FireServer()
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.