Touched script not working

I’m working a game called Chalk Warfare and there is a Touched function which does not work hears a screenshot:

yomama

And here is the output section once I touch the part:

There is a variable for everything in that script.

If you could help please do so.

There is so many reasons as to why this may not be working, especially since the output doesn’t provide us with any real deductive information. It’s really hard to help when we only see the events and nothing else, as well as the fact that you haven’t really told us what it’s meant to do.

It’s a pretty simple script as its only making a UI visible, by touching a part.

I would like the very first few lines of your script because according to your code, line 1 is the issue. You can check that or show it to me.
Also, please don’t show an image of the script but copy and paste it, it’ll make it easier, of course not the whole script needs to be pasted.

You need to wait for the humanoid.

Also, is it chalk warfare like you draw stuff on the walls then it comes to life? If so, thats epic.

Yeah, thanks well ill see what everyone says about this and ill test everything

Can you show the console when you actually interact with the touched part & clicked button?

Sure though the part needs to be touched for the button be visible.

You could set the button to visible by default for debugging purposes.

Alright, i’ll send a video tomorrow a little late for me here, so ill respond tomorrow.

When i make the frame visible and i click the yes button and yet the part doesn’t become visible

First, is it a local script or a server script? Also, show me where you defined the variable “background1”. Also show me where you defined the variable “a”. Then I can know the problem.

Its a local script in StarterGUI

Fortunately, I have just the answer!
First, create a remoteEvent inside ReplicatedStorage. Call it “ShowGuiOnTouch”
You can make a script inside server script service and put this in:

local myPart = --your part here
myPart.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
        game.ReplicatedStorage.ShowGuiOnTouch:FireClient(game.Players:GetPlayerFromCharacter(hit.Parent)
    end
end)

Now put this inside a local script in starter gui:

local gui = --your gui here
game.ReplicatedStorage.ShowGuiOnTouch:Connect(function()
    gui.Visible = not gui.Visible
end

There you go! Don’t forget to set as solution if this worked :slight_smile: