Hello. I am making a game and I wanted to make it where you have to press E when you get close to this dog so that you can talk to it. It works, it clones into the PlayerGUI when you press E, but it won't let you interact with the GUI once it is cloned into the PlayerGUI. I tested the GUI before putting it into the script and it worked, but when I put it back into the script, you can't click the button. The GUI is in a local script in the StarterGui. The script in the local script:

local Part = game.Workspace.Dogwood.Torso
local UserInputService = game:GetService("UserInputService")
local Player = game.Players.LocalPlayer.Character:WaitForChild("HumanoidRootPart")

UserInputService.InputBegan:Connect(function(keyCode)
	if keyCode.keyCode == Enum.KeyCode.E then
		if (Part.Position - Player.Position).magnitude < 20 then
			print("E has been pressed")
	script.TalkToDogWoodQuest1.Enabled = true
			local newGui = script.TalkToDogWoodQuest1:Clone()
			newGui.Name = "CloneofTalkToDogWoodQuest1"
		script.TalkToDogWoodQuest1.Enabled = false
			newGui.Parent = script.Parent
	
		end
	end
end)

I tried even making the GUI enabled to see if that was the cause of the button not working, but that didn't work either. The ImageButton has three scripts. First script:

script.Parent.TextLabel.Text = "Awe, such a cute little dog!"

script.Parent.MouseButton1Click:Connect(function()
	script.Parent.Parent.Parent.DogTalkTooCool.Visible = true
	script.Parent.Parent.Parent.DogTalkTooCool.TheTalkingText.LocalScript.Disabled = false
	script.Parent.Parent.Visible = false
end)

Second script:

script.Parent.MouseButton1Click:Connect(function()
	print("CLICKY")
	script.Parent.Parent.Parent.DogTalk.Visible = true
	script.Parent.Parent.Parent.DogTalk.TheTalkingText.LocalScript.Disabled = false
	script.Parent.Parent.Visible = false
	
end)


script.Parent.MouseEnter:Connect(function(x, y)
	local colorPress = Color3.new(0.858824, 1, 0.85098) -- green
	local imageButton = script.Parent
	imageButton.ImageColor3 = colorPress
	
end)

script.Parent.MouseLeave:Connect(function(x, y)
	local colorLeave = Color3.new(0.737255, 0.862745, 0.733333) -- green
	local imageButton = script.Parent
	imageButton.ImageColor3 = colorLeave


end)

The local script:

local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid",10)

local low = script.Parent.GoldSettings.MinGold.Value
local max = script.Parent.GoldSettings.MaxGold.Value
local mlvl = script.Parent.GoldSettings.Lvl.Value
local stats = plr:findFirstChild("leaderstats")
local Lvl = stats.Points

if stats ~= nil and Lvl.Value >= mlvl then

	print("This player has done the quest before!")
	script.Parent.IfYouAreCool.Disabled = false

end 

if Lvl.Value < mlvl then
	print("Noob")
end

Then there is a configuration inside of the button and it has three IntValues. Thank you!

2 comments

0

So everything works. But when you clone the StarterGui into the PlayerGui you cant interact with it?

0

@Galaxybombboy, hi, thanks for responding! Yes, everything works but when it is cloned into the PlayerGui, you can't interact with it.