#buy weapon by touching it

38 messages · Page 1 of 1 (latest)

hot glen
#

is a simple system but im new in this

unborn orchid
#

Did you write this in a local script?

unborn orchid
#

Also, which errors are you getting?

hot glen
#

I have this set up but when I interact nothing happens

#

and this script

#

what i can do

#

i have the gun (usp) in ServerStorage

modest sapphireBOT
#

studio** You are now Level 1! **studio

hot glen
#

@unborn orchid

vagrant osprey
#

aigh instead of the local script insert a serverscript inside of the proximinity promt like this

#

and here is the script

#

local toolName = "USP" -- Cambia esto por el nombre del modelo del arma en ReplicatedStorage
local price = 100 -- Precio del arma

local ReplicatedStorage = game:GetService("ReplicatedStorage")

script.Parent.Triggered:Connect(function(Player)
-- Verificar si el jugador tiene suficiente dinero
if Player.leaderstats.Coins.Value >= price then
-- Quitar el dinero
Player.leaderstats.Coins.Value = Player.leaderstats.Coins.Value - price

    -- Dar el arma al jugador
    local weapon = ReplicatedStorage:FindFirstChild(toolName)
    if weapon then
        local weaponClone = weapon:Clone()
        weaponClone.Parent = Player.Backpack
    else
        warn("No se encontró el arma en ReplicatedStorage.")
    end
else
    print("No tienes suficiente dinero.")
end

end)

static kite
hot glen
#

nothing

#

;c

#

I interact and nothing happens

vagrant osprey
hot glen
#

This is in a normal script

#

what i do

#

@vagrant osprey

vagrant osprey
# hot glen

did you put the code in the serverscript which i sent you?

hot glen
#

wait, replace my script with the one you sent me, did I do wrong?

#

and I left all this in workspace

vagrant osprey
hot glen
#

and

vagrant osprey
#

then it should work

hot glen
modest sapphireBOT
#

studio** You are now Level 2! **studio

hot glen
#

nothing

#

He doesn't give me the gun or take my money

vagrant osprey
#

then something must be wrong with the other stuff i just showed you how to detect the E pressed

#

did you get any errors?

hot glen
#

I tried it, but it didn't work for me. but thank you anyway!