Well, that’d be because when you change where you put the objects in the explorer, the variables you put in the localscript won’t find it. You have to either keep everything where it is, and if you change where they are, change the variables in the localscript to match their new areas.
Also, is it meant to only let you click it once and never again? Because you never put “alreadyclicked” back to false, which means you can only click it once, because of the if statement’s condition.
Try it without the alreadyclicked part of the script. That way we can pinpoint if the problem is with that part of it or not. Here, I just commented out those parts:
local objectgui = script.Parent.Parent.Parent
local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(0.1, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, true)
local buttonEffect = TweenService:Create(objectgui, tweenInfo, {Size = UDim2.new(3.2, 0, 1.2, 0)})
--local alreadyclicked = false
script.Parent.MouseButton1Click:Connect(function()
-- if alreadyclicked == false then
print("no way")
alreadyclicked = true
buttonEffect:Play()
wait()
local a = Instance.new("Part")
a.Size = Vector3.new(1,1,1)
a.Anchored = true
a.Transparency = 1
a.Parent = script.Parent.Parent.Parent.Adornee
a.CFrame = a.Parent.texture.CFrame:ToWorldSpace(CFrame.new(-1,0.2,-0.5))
a.CFrame = CFrame.new(a.Position,a.Parent.Position)
game.Workspace.Camera.CameraType = Enum.CameraType.Scriptable
game.Workspace.Camera.CFrame = a.CFrame
-- end
end)
Oh that’s odd… try placing a print() statement before the MouseButton1Click event, to see if the script is even working at all or getting past the variables.
Oh man, must be something weird going on with the script… did you put a print() at the very beginning of the localscript? Perhaps we could get someone who might have an idea of what’s going on. You might want to copy the contents of that localscript into a new localscript, just in case something’s wrong with it.
Hmm okay odd. Sorry for the hassle, but could you try putting it in the very beginning of the localscript before anything else? If this doesn’t work then there’s something strange going on, and you’ll want to try moving the code into a new localscript.
yes i already try to put it before anything too, still not work. i also try with new script and still not working. i dont know why maybe this is a bug?
This script is placed inside of ScreenGUI? And if you just had a print statement in the localscript (nothing else) does it work? This could be a problem with the localscript not running in the first place due to where it’s placed.