#won't detect touch. help?

1 messages · Page 1 of 1 (latest)

rustic lava
#

Bought a setup online, since I don't know how to code for roblox just yet. Getting no support from who I bought from.

The upgrades gui doesn't pop up, and it seems like there's no detection at all.

The shop gui works:

local shopP = game.Workspace:WaitForChild(`OpenShop`)

shopP.Touched:Connect(function(hit)
    local character = hit.Parent
    local humanoid = character:FindFirstChildOfClass("Humanoid")

    if debounce == false and humanoid and humanoid:IsA("Humanoid") then
        local player = game.Players:GetPlayerFromCharacter(character)

        if player and player == game.Players.LocalPlayer then

            if shopV.Value == false then

                shopV.Value = true
            end
        end
    end
end)

Yet the upgrades Gui doesn't. None of the debugs get sent at all.

local upgP = game.Workspace:WaitForChild(`OpenUpgrades`)


upgP.Touched:Connect(function(hit)
    print("1")
    local character = hit.Parent
    local humanoid = character:FindFirstChildOfClass("Humanoid")
    if debounce == false and humanoid and humanoid:IsA("Humanoid") then
        local player = game.Players:GetPlayerFromCharacter(character)
        print("2")
        if player and player == game.Players.LocalPlayer then
            local leaderstats = player:FindFirstChild("Lands")
            print("3")
            if leaderstats then
                local boolValue = leaderstats:FindFirstChild("Desert")
                print("4")
                if boolValue and boolValue.Value == true then
                    print("5")
                    if UpgV.Value == false then
                        print("6")
                        UpgV.Value = true
                    end
                else
                    print("7")
                    if canPrintMessage then
                        module.Pop.Local(
                            "You shouldn't be here!",
                            Color3.new(1, 0.160784, 0.160784),
                            5,
                            {"Drop", "Shrink"},
                            nil
                        )     
                        canPrintMessage = false
                        wait(3)  
                        canPrintMessage = true
                    end
                end
            else
                print("Leaderstats not found.")
             end
        end
    end
end)

I can find OpenUpgrades and OpenShop just fine in the Workspace, and touch is enabled, plus the outline of the location shows in the correct place.

sleek meadow
#

consult the person or place you purchased this setup from 👍

rustic lava
#

so, i'm just trying to fix it myself

#

or, with help here

midnight moon
#

check if open upgrades is even in workspace when you are testing

midnight moon
#

it could be unanchored and can collid off

midnight moon
rustic lava
#

it's still there when i use the play button anyway, does testing work differently?

midnight moon
#

okay so nothing gets printed right

#

not even '1'

#

when you touch

rustic lava
#

yes

#

nothing

midnight moon
#

print upgP before the touched event

#

check if the script finds it

rustic lava
#

okay

midnight moon
#

nothing prints?

rustic lava
#

haven't got to it yet

ocean scaffoldBOT
#

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

rustic lava
#

just a sec

midnight moon
#

okay I'll respond later

rustic lava
narrow prairie
#

Maybe CanTouch is off

rustic lava
narrow prairie
rustic lava
#

dont exactly want the player to be get stuck on the invisible barrier they're touching

#

cancollide is off on the shop one that works

narrow prairie
#

But you cant touch it if cancollide is off can you

ocean scaffoldBOT
#

studio** You are now Level 10! **studio

narrow prairie
#

Finally im level 10

rustic lava
#

you can

#

the hitbox of my character and the hitbox of the invisible barrier are still touching

#

key word here, touching

#

and again, it works on the shop one, which also has colliding off

narrow prairie
#

It doesnt even print 1?

rustic lava
narrow prairie
#

Can u add if upgP then print("2") end

#

See if it prints 2

#

Put it after the upgD

rustic lava
#

sure

narrow prairie
#

Did it print 2

undone obsidian
rustic lava
#

i really dont know how to script so im a little confused on where you want me to put the code honestly

narrow prairie
#

Below the upgD

undone obsidian
rustic lava
#

i need to learn how to run this man

rustic lava
undone obsidian
rustic lava
undone obsidian
#

Can you show the explorer where i can see where is located the open upgrades?

undone obsidian
rustic lava
#

i just dont know how to run it or something

#

like it didnt print the else either

narrow prairie
#

After 10 sec it didnt print anything at all?

rustic lava
#

so maybe the entire script doesnt work

narrow prairie
#

So either the script is disabled or skill issue

rustic lava
undone obsidian
rustic lava
#

i've got this issue in the script actually

undone obsidian
#

Where is located the script

rustic lava
#

do you think this is causing the rest of the script not to work

#

since thats before the 10 second thing

ocean scaffoldBOT
#

studio** You are now Level 3! **studio

undone obsidian
undone obsidian
midnight moon
rustic lava
#

its a local script

#

could be an issue

#

no idea though, i seriously have no idea what im doing

rustic lava
midnight moon
#

put it in a server script

#

touched only works on server

rustic lava
midnight moon
undone obsidian
#

his script is not even running

lucid ocean
#

Does it open the gui?

rustic lava
undone obsidian
#

Put a warn on top of the script

lucid ocean
#

Try adding print after the if statement

#

And see if it fires

undone obsidian
#

Like i said to see if its running

#

But like first line

lucid ocean
#

Also could be

#

But im not sure

midnight moon
lucid ocean
#

I normally just make a server script

midnight moon
#

there's nothing specific

#

befor

#

the touched event

lucid ocean
rustic lava
lucid ocean
#

Try putting a print after the if debounce == false statement

#

Like: print("test")

rustic lava
#

theres already a print

lucid ocean
#

To see if it detects the player

#

Oh does that fire?

rustic lava
#

no

#

no prints do

lucid ocean
#

Hm

#

Whats the location of the local script?

rustic lava
#

StarterGui > OpenGuiParts

lucid ocean
#

Alr and is the part name the same as OpenShop and located in workspace?

rustic lava
lucid ocean
#

OpenShop

rustic lava
#

i think you've got it confused

lucid ocean
#

It has to be named OpenShop

rustic lava
#

OpenShop is the GUI that already works on touch

#

OpenUpgrades is the one im having problems with

#

be sure to read my entire first message

lucid ocean
#

The touch part is named OpenShop right?

#

Cuz it HAS to be named OpenShop for it to work and it also HAS to be in workspace

rustic lava
#

can you please read my message

lucid ocean
#

You said the touch part didint fire right?

rustic lava
#

yes, for OpenUpgrades

#

i sent two code blocks in my post message

lucid ocean
#

Oh

rustic lava
#

yeah

lucid ocean
#

So 1 does not print?

rustic lava
#

it doesnt print

lucid ocean
#

Could you send the full output?

rustic lava
#

what do you mean?

lucid ocean
#

The little box where you can see the prints

rustic lava
#

thats the full thing

lucid ocean
#

Hm

#

Try printing upgP

#

Below it

rustic lava
#

so

#

it was literally just stopping any progression in the script

lucid ocean
#

Bruh i thought that was a dif script ngl

#

Alr well gl

rustic lava
#

thanks