Solved I need help with a skript that gives u a kit on gui but i need to add a cooldown

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the community!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

habbic

Member
Mar 18, 2024
30
0
6
function security(p: player):
set {_gui} to chest inventory with 1 rows named "SD-GUI"

set slot 4 of {_gui} to netherite sword named "&eᴄʟɪᴄᴋ ᴛᴏ ɢᴇᴛ ᴛʜᴇ ᴋɪᴛ"
open {_gui} to {_p}

on inventory click:
name of event-inventory is "SD-GUI"
cancel event
event-inventory is not player's inventory
if clicked slot is 4:
if group of player = "security-base":
if event-entity's display name contains "ꜱᴅ":
execute console command "/kit give sd %player%"
set {_waited} to difference between {sdkitclaim::%uuid of player%} and now
if {_waited} is less than 1 day:
while name of player's current inventory is "SD-GUI":
set {difference} to %difference between a day and {_waited}%
wait 1 second
set {sdkitclaim::%uuid of player%} to true
else:
delete {sdkitclaim::%uuid of player%}
set {sdkitclaim::%uuid of player%} to now
 
Can you please provide your code with proper indentation and code formatting? You can click the "code" button at the top of your post window to do this.
1710781853586.png
 
Code:
function security(p: player):
    set {_gui} to chest inventory with 1 rows named "SD-GUI"

    set slot 4 of {_gui} to netherite sword named "&eᴄʟɪᴄᴋ ᴛᴏ ɢᴇᴛ ᴛʜᴇ ᴋɪᴛ"
    open {_gui} to {_p}

on inventory click:
    name of event-inventory is "SD-GUI"
    cancel event
    event-inventory is not player's inventory
    if clicked slot is 4:
        if group of player = "security-base":
            if event-entity's display name contains "&7ꜱᴅ":
                if {-cooldowns::%uuid of player%::sd} > now:
                    cancel event
                    set {_diff} to difference between {-cooldowns::%uuid of player%::sd} and now
                    send "&4&lᴇʀʀᴏʀ: &cʏᴏᴜ ᴍᴀʏ ᴜꜱᴇ ᴛʜɪꜱ ᴋɪᴛ ᴀꜰᴛᴇʀ ᴅᴇᴀᴛʜ." to player
                else:
                    set {-cooldowns::%uuid of player%::sd} to 99999 hours from now
                    execute console command "/kit give sd %player%"



on respawn:
    delete {-cooldowns::%uuid of player%::*}
    
on rightclick:
    if group of player = "security-base":
        if event-entity's display name contains "ꜱᴅ":
            open {_gui} to player
1710726918140.png
 
Much obliged.

And what do you need help with? Also what addons do you have and does this return any errors?
So, i am trying to make a skript when i right click this citizen npc it opens a gui with a item that gives u a kit but i wanted to add a cooldown for like 99999 hours and delete the var after the death of player i wanted to do it so u can claim the kit once a life
 
just set the variable to true and delete it on respawn (kind of like what you have), so like this

Python:
function security(p: player):
    set {_gui} to chest inventory with 1 rows named "SD-GUI"
    set slot 4 of {_gui} to netherite sword named "&eᴄʟɪᴄᴋ ᴛᴏ ɢᴇᴛ ᴛʜᴇ ᴋɪᴛ"
    open {_gui} to {_p}

on inventory click:
    name of event-inventory is "SD-GUI"
    cancel event
    event-inventory is not player's inventory
    if clicked slot is 4:
        if group of player = "security-base":
            if event-entity's display name contains "&7ꜱᴅ":
                if {-cooldowns::%player's uuid%::*} is set:
                    cancel event
                    send "&4&lᴇʀʀᴏʀ: &cʏᴏᴜ ᴍᴀʏ ᴜꜱᴇ ᴛʜɪꜱ ᴋɪᴛ ᴀꜰᴛᴇʀ ᴅᴇᴀᴛʜ." to player
                else:
                    execute console command "/kit give sd %player%"



on respawn:
    delete {-cooldowns::%uuid of player%::*}
    
on rightclick:
    if group of player = "security-base":
        if event-entity's display name contains "ꜱᴅ":
            open {_gui} to player