Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is my tool proximity prompt not disabling when I clone the tool?

Asked by 2 years ago

I am working on a game that involves Proximity Prompts. The players will trigger the proximity prompts to get a tool.


local prox = script.Parent

script.Parent.Triggered:Connect(function(player)
    prox.Enabled = false
    script.Parent.Parent.Transparency = 1

    local rs = game:GetService("ReplicatedStorage")

    local GasCan = rs:FindFirstChild("Gas Can")

    GasCan.Parent = player.Backpack
end)

This did work, however, when the player triggered the proximity prompt to get the tool, other players could not get the tool when they triggered the prompt. So, what I did was remake the script so this time it would Clone the tool, and put the Clone inside the player's Backpack. Not the actual tool.


local prox = script.Parent

script.Parent.Triggered:Connect(function(player)
    prox.Enabled = false
    script.Parent.Parent.Transparency = 1

    local rs = game:GetService("ReplicatedStorage")

    local clomes = rs:FindFirstChild("Gas Can"):Clone()


    clomes.Parent = player.Backpack
end)

That script did fix the problem, but created a new one as well. Now, when any player triggers the event, the proximity prompt doesn't go away, meaning that the players can just duplicate the same item over and over again in their inventory. What it's supposed to do is make the Gas Can go Invisible, and disable the Proximity.

The weird thing is, it only works for the bottom half of the script, and it basically just ignores the part where it's supposed to Disable the prox and make a Gas Can invisible.

Does anyone know how to fix this?

0
can there be multiple parts inside of each other, the triggered prompt goes away, but there are duplicates inside of it? also, this is not LocalScript, right? imKirda 4491 — 2y
0
There are no other parts inside of it. And No, the Proximity Prompt uses a Normal Script. JackyW9cky 27 — 2y

Answer this question