#help

132 messages · Page 1 of 1 (latest)

haughty brook
#

here's a sample on how you can do this

local db = false

script.Parent.MouseButton1Up:Connect(function()
    if db == false then
        db = true
        for i,v in game:GetService("ReplicatedStorage").WeaponsFolder:GetChildren() do
            v:Clone().Parent = game.Players.LocalPlayer.Backpack
        end
        task.wait(120)
        db = false
    end
end)
#

you can modify this to your likings ^

#

and you should search google more before making a post

rotund light
#

when you click it send a request to the server via a remote event

#

have a db

#

show

#

yeah that won’t work

#

do you know remoteevents

#

place that in replicated storage

#

or wherever you organize it there

#

yes

#

no

#

local ToolsEvent = game.ReplicatedStorage.ToolsEvent

local Cooldown = {
DrumMag = {DB = {}, Item = game.ServerStorage.Tools.DrumMag}
}

local function GiveTool(Player, Tool)
if not Cooldown[Tool] then return end

if Cooldown[Tool].DB[Player.Name] then return end

Cooldown[Tool].DB[Player.Name] = task.delay(120, function()
Cooldown[Tool].DB[Player.Name] = nil
end)
for i = 1, 10 do
Cooldown[Tool].Item:Clone().Parent = Player.Backpack
end
end

ToolsEvent.OnServerEvent:Connect(GiveTool)

#

that’d be somewhat what you would have for the server

#

currently on mobile so pardon any errors lmao

#

took too long to type all that with this phone

rotund light
#

yeah

#

alr im going to bed, you should be able to change that to your liking, for the client you should only need to fire “DrumMag” or whatever tool you want, that you add later on

#

if you need help im sure someone else can help you

#

what is it

#

no error?

#

show me what you have

#

change the cooldown entry to this

#

made a typo there

#

, but is there any errors?

#

show me client and where your tool is stored

#

change the item

#

to where yours is

#

also keep the script the same

#

you messed up some things

#

other than the event and tool don’t change it

#

you changed DB to DrumMag

#

but you try to index DB later

#

debounce

#

you could change the dictionary to this

local Tools = {
DrumMag = {Cooldown = {}, Item = ToolPath}
}

#

yeah

#

yeah but you didn’t change the Item key still

#

script

#

in server script service

#

-_-

#

yeah

#

so do all that i said and in your GUIs script you only need to fire the event

median merlinBOT
#

studio** You are now Level 6! **studio

rotund light
#

your script for clicking the button

#

is there an error

#

show both your gui and servers script

#

you need to

#

yeah

#

have it under the click event for your button

#

it should be in replicated storage

#

your event

#

local MagEvent = game.ReplicatedStorage:WaitForChild "MagEvent"

script.Parent.Activated:Connect(function()
MagEvent:FireServer("DrumMag")
end)

#

my phone is buggin rn

#

think it’s discord or smth

#

but that should work

#

no problem man

#

now ima head to bed

#

gn

haughty brook
#

this was just a sample i didnt give you the entire thing

#

its debounce

#

its like to prevent something from happening for an amount of time

#

@spark stump

local debounce = false

if debounce == false then --checking if there is no debounce enabled
    debounce = true --enable it so you prevent the person from doing the action
    
    --continuation of the code
    
    --you can optionally add a task.wait() with any amount of time here
    debounce = false --disable it so the person can do the action again
end
#

it's because i dont really have access to what your game's contents are

#

it was just a sample script

#

sure

#

remove the elseif

#

and return

#

and try again

#

remove

#

return var2_upvw then
return

#

uh no

#

okay try

#

can you remove var2_upvw = false and put it at the end of the function

#

i said the end of the function

#

the if function

#

after script.parent.text = "drummag"

#

what is this

#

and why did you specify the variable if you're just gonna ignore it and use something else here

#

and i've noticed you're using .Activated twice?

#

i kind of see the problem here

#

cool but you should use :WaitForChild("MagEvent") because without the brackets is a little deprecated

#

@spark stump how many remote events do you have

#

?

#

im talking about this one

#

and where is that remote event?

#

that you're using

#

i got the issue

#
local MagEvent = game:GetService("ReplicatedStorage"):WaitForChild("MagEvent")
local var2_upvw = false

script.Parent.Activated:Connect(function()
    if var2_upvw == false then
        var2_upvw = true
        script.Parent.Text = "Cooldown (DrumMag)"
        MagEvent:FireServer("DrumMag")
        task.wait(1)
        script.Parent.Text = "DrumMag"
        var2_upvw = false
    end
end)
#

use this

#

the issue was this

#

probably

haughty brook
#

what is the script

#

why the return at the end

#

remove that

#

remove it

#

return doesnt work like that

#

where is the extendedclip script

#

i dont see any line with something related to doing something to the backpack

#

you have a server side script inside of a screengui

#

you cant use serverscripts inside screenguis

#

you put those in serverscriptservice

median merlinBOT
#

studio** You are now Level 7! **studio

haughty brook
#

bro 😭

#

how am i gonna help you if you dont know the basics of roblox studio and scripting

#

you dont know when to use a local script and server script and where to put them

#

i dont know what the contents of the scripts are

#

so i assumed you had something to works for server scripts

#

and you have a mousebutton1up in a serverscript

#

which can only be used from localscripts

#

maybe you can read the documents or see a tutorial on the basics of scripting

#

there are thousands of those

rotund light
#

@turbid jetty

turbid jetty
#

the jeff bezos guy undid everything

#

?

rotund light
#

yes

turbid jetty
#

how

rotund light
#

look at the history of the messages

turbid jetty
#

ok

rotund light
#

it’s not deprecated

turbid jetty
#

no wonder

#

vros an s1

#

😭

rotund light
#

why would a syntactic sugar be deprecated

turbid jetty
#

@haughty brook

#

?

#

im gonna grind scripting help so i can get helper role

rotund light
#

i always be here smh

#

helping

#

where is my role

turbid jetty
#

idk if thats how u get it