#Make script work on more stuff other than a single thing idk how to explain

106 messages · Page 1 of 1 (latest)

warm girder
#

so this script it only works on a single model but when i duplicate the model into many model it would only work on one, idk how to make it work on multiple models

zinc merlin
#

Lets start off with

#

Do you have any error?

warm girder
#

nope

#

btw im new to scripting

zinc merlin
#

Alright

#

Welcome to Lua

warm girder
#

real

#

my discord crashed lol

zinc merlin
#

lol

warm girder
#

anyways

#

do u know how to script?

zinc merlin
#

Yes

warm girder
#

okay

warm girder
#

kinda need help

zinc merlin
#

Is there a ProximityPrompt in every model?

warm girder
#

i made the script ik it looks messy ash

warm girder
zinc merlin
#

I see the issue

warm girder
#

when i duplicate

#

it only works on a single model

zinc merlin
#

Alright

#

I want you to make a folder in workspace

#

name it Atm(s)

#

Please place all atms into it

warm girder
#

i did

warm girder
#

ye

#

thats the folder

zinc merlin
#

Yup one sec

#

This should work```lua
local Atms = game:GetService("Workspace"):WaitForChild("ATMS") -- Getting atms
local GearAccess = game:GetService("Players").Localplayer:WaitForChild("Backpack")

local function AtmsToggle(Action:Boolean)
if Action == true then
for i, atm in ipairs(Atms:GetChildern) do -- Gets all the ATMs
atm.RobPart.ProximityPrompt.Enabled = true
end
else
for i, atm in ipairs(Atms:GetChildern) do -- Gets all the ATMs
atm.RobPart.ProximityPrompt.Enabled = false
end
end
end

-- Call the function
GearAccess.AKMN.Equipped:Connect(function()
AtmsToggle(true)
end

GearAccess.AKMN.Unequipped:Connect(function()
AtmsToggle(true)
end

warm girder
#

Ok

#

does not work

#

do u want me to send u the model?

zinc merlin
#

sure

warm girder
#

Ok 1 sec

zinc merlin
#

wait

#

I see the bug

#

local Atms = game:GetService("Workspace"):WaitForChild("ATMS") -- Getting atms
local GearAccess = game:GetService("Players").Localplayer:WaitForChild("Backpack")

Fixed```lua
local function AtmsToggle(Action:Boolean)
if Action == true then
for i, atm in ipairs(Atms:GetChildern()) do -- Gets all the ATMs
atm.RobPart.ProximityPrompt.Enabled = true
end
else
for i, atm in ipairs(Atms:GetChildern()) do -- Gets all the ATMs
atm.RobPart.ProximityPrompt.Enabled = false
end
end
end

-- Call the function
GearAccess.AKMN.Equipped:Connect(function()
AtmsToggle(true)
end

GearAccess.AKMN.Unequipped:Connect(function()
AtmsToggle(true)
end```

warm girder
#

Ok

#

lemme try that

#

does not work

zinc merlin
#

Got it working

#
local Atms = game:GetService("Workspace"):WaitForChild("ATMS") -- Getting atms


local function AtmsToggle(Action) 
    if Action == true then
        for i, atm in ipairs(Atms:GetChildren()) do -- Gets all the ATMs
            atm.RobPart.ProximityPrompt.Enabled = true
        end
    else 
        for i, atm in ipairs(Atms:GetChildren()) do -- Gets all the ATMs
            atm.RobPart.ProximityPrompt.Enabled = false
        end
    end
end

-- Call the function
script.Parent.Equipped:Connect(function()
    AtmsToggle(true)
end)

script.Parent.Unequipped:Connect(function()
    AtmsToggle(true)
end)
warm girder
#

Ok

#

lemme test it

#

still dont work

zinc merlin
#

Can I see your script?

warm girder
mental marshBOT
#

studio** You are now Level 4! **studio

zinc merlin
#

I forgot to change one small thing this should work ```lua

local Atms = game:GetService("Workspace"):WaitForChild("ATMS") -- Getting atms

local function AtmsToggle(Action)
if Action == true then
for i, atm in ipairs(Atms:GetChildren()) do -- Gets all the ATMs
atm.RobPart.ProximityPrompt.Enabled = true
end
else
for i, atm in ipairs(Atms:GetChildren()) do -- Gets all the ATMs
atm.RobPart.ProximityPrompt.Enabled = false
end
end
end

-- Call the function
script.Parent.Equipped:Connect(function()
AtmsToggle(true)
end)

script.Parent.Unequipped:Connect(function()
AtmsToggle(false)
end)

warm girder
#

okayz

#

lemme test it again

#

still dont work

zinc merlin
#

Hm

warm girder
warm girder
#

@zinc merlin u there?

zinc merlin
warm girder
#

okay

warm girder
zinc merlin
warm girder
#

.

#

@zinc merlin do you know anybody that can do this?

zinc merlin
#

Wait

#

not ask hire someone

#

ask in #📜︱scripting

warm girder
#

what do i say

#

my english is trash

zinc merlin
#

How do I make a script that when I equipped a tool it enable a proximity prompt of items in a folder?

warm girder
#

thx

warm girder
#

I mean like

#

How do i make it so when i duplicate the items into more the proximity will enable not just one item

zinc merlin
warm girder
#

yes

zinc merlin
#

I see

warm girder
#

it already works when I equipped a tool it enable a proximity prompt but only works in 1 item but when i duplicate it doesnt work for the others

#

only 1 item

zinc merlin
#

I found the bug! this should work```lua

local Atms = game:GetService("Workspace"):WaitForChild("ATMS") -- Getting atms

local function AtmsToggle(Action)
if Action == true then
for i, atm in ipairs(Atms:GetChildren()) do -- Gets all the ATMs
atm.RobPart.ProximityPrompt.Enabled = true
end
else
for i, atm in ipairs(Atms:GetChildren()) do -- Gets all the ATMs
atm.RobPart.ProximityPrompt.Enabled = false
end
end
end)

-- Call the function
script.Parent.Equipped:Connect(function()
AtmsToggle(true)
end)

script.Parent.Unequipped:Connect(function()
AtmsToggle(false)
end)

warm girder
#

ok

#

still dont work 😬

zinc merlin
#

Bruh

#

I'll look into this more you move on with your game

warm girder
#

okay

warm girder
zinc merlin
warm girder
#

okay

mental marshBOT
#

studio** You are now Level 5! **studio

patent lion
#
local Atms = game:GetService("Workspace"):WaitForChild("ATMS") -- Getting atms

local function AtmsToggle(Action)
    for _,atm in Atms:GetChildren() do -- Gets all the ATMs
       atm.RobPart.ProximityPrompt.Enabled = Action
    end
end)

-- Call the function
script.Parent.Equipped:Connect(function()
    AtmsToggle(true)
end)
script.Parent.Unequipped:Connect(function()
    AtmsToggle(false)
end)
#

wayyy cleaner way to do it

#

you dont have to code nest

#

and using ipairs is slow, just make it check for children

warm girder
#

Ok

#

ill just test

#

cus i need to finish game within a week

warm girder
#

ughhhhh how do i make this work

patent lion
#

You're probably not locating the script properly.

warm girder
#

its been 2 days im trying to figure this out