#Need help with proximity promts

1 messages · Page 1 of 1 (latest)

tight mantle
#

so basically i want to make it so i can only activate the prompt while holding a certain tool it dosent detect that i am holding the fruit and dosent print

local players = game:GetService("Players")

local fruitfolder = rs:WaitForChild("Fruits")
local container = script.Parent.Parent
local prompt = script.Parent
prompt.ClickablePrompt = false
local remev = prompt:WaitForChild("yes")
remev.OnServerEvent:Connect(function(player,equiped)
    if equiped  then
        prompt.ClickablePrompt = false
    elseelse
        prompt.ClickablePrompt = true
    end
end)



prompt.PromptButtonHoldBegan:Connect(function(olayer)
    print(olayer.Name)
end)``` this is the server script

```local players = game:GetService("Players")
local player = players.LocalPlayer
local prox = script.Parent
local remev = prox:WaitForChild("yes")
local function checkfruit(fruit)
    if fruit:IsA("Tool") then
        fruit.Equipped:Connect(function()
        remev:FireServer(true)
            print(fruit.Name.."equipped")
        end)
        fruit.Unequipped:Connect(function()
            remev:FireServer(player,false)
            print(fruit.Name.."unequipped")
        end)

    end
end
players.PlayerAdded:Connect(function(player)
    player.Backpack.ChildAdded:Connect(checkfruit)
end)``` local script
weak geyser
#

@tight mantle still need help?

tight mantle
weak geyser
#

what’s this elseelse

#

have u got any errors in output

tight mantle
#

it js dosent work

weak geyser
#

put the players.PlayerAdded event in the server script

#

as the checkfruit function does not run right

#

lmk @tight mantle

tight mantle
weak geyser
#

just wondering where is ur local script and server script in

honest flareBOT
#

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

weak geyser
#

local scripts don’t work in workspace

#

or where is that located

#

starter pack?

tight mantle
weak geyser
#

yeah

#

local scripts don’t work in workspace

#

and remote events shouldn’t be in workspace

tight mantle
weak geyser
#

put remote event in replicated storage

#

actually it will still work in workspace

#

probably

weak geyser
#

and put the remote event in replicated storage it’s just better tbh

#

designated storage for it

tight mantle
#

oh yeah btw

#
    player.Backpack.ChildAdded:Connect(checkfruit)
end)``` how do i move this into the server script cuz the check fruit function is in the local script
weak geyser
#

don’t yet I guess try do it with local script outside of workspace

#

because it doesn’t work there

tight mantle
#

and it dosent work

#

it works

#

it works now i js had to use players.localplayer.backpack.childadded:connectfuinction(checkfruit)

#

instead of player added