Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Mouse Click Not Activating? [NO SOLUTION?]

Problem is, It won't even activate. Won't Print Activated at all. Yes, its a server script. And Its in Workspace, and FE is on.

AND IT WORKS IN STUDIO. AND ONLY IN STUDIO.

local Char = script.Parent.Char
local Water = script.Parent.Liquid
local Button = script.Parent.Button
local CanClick = true
local Left = 10
local Hats = script.Parent.Char:GetChildren()
local HeadOriginalCFrame = Char.Head.Frame


script.Parent.Button.ClickDetector.MouseClick:connect(function(Player)
print("Activated")
if CanClick == true then CanClick = false
for i=50,2,-.2 do
Water.Mesh.Scale = Vector3.new(Water.Mesh.Scale.X,Water.Mesh.Scale.Y-.2,Water.Mesh.Scale.Z)
Water.Position = Vector3.new(Water.Position.X,Water.Position.Y -.02,Water.Position.Z)
wait()
end
local Torso = Player.Character:FindFirstChild("Torso")
if Torso then
local DefaultCFrame = {Char.Head.CFrame:components()}
local LookLimit = coroutine.create(function()
for i=1,Left do
Left = Left -1
wait(1)
end
Left = 10
end)
coroutine.resume(LookLimit)
repeat
Char.Head.CFrame = CFrame.new(Char.Head.Position,Torso.Position)
wait()
until Left == 0
Char.Head.CFrame = CFrame.new(DefaultCFrame[1],DefaultCFrame[2],DefaultCFrame[3],DefaultCFrame[4],DefaultCFrame[5],DefaultCFrame[6],DefaultCFrame[7],DefaultCFrame[8],DefaultCFrame[9],DefaultCFrame[10],DefaultCFrame[11],DefaultCFrame[12])
end
for i=2,50,.2 do
Water.Mesh.Scale = Vector3.new(Water.Mesh.Scale.X,Water.Mesh.Scale.Y+.2,Water.Mesh.Scale.Z)
Water.Position = Vector3.new(Water.Position.X,Water.Position.Y +.02,Water.Position.Z)
wait()
end
CanClick = true
Char.Head.CFrame = HeadOriginalCFrame
end
end)

3 comments

0

Please please PLEASE tab your code. It makes it easier to read for both you and those attempting to analyze.

0

Why would it print "Activated?" It doesn't say print("Activated") anywhere.

0

Sorry I replaced the script and well. Let me update it again.

2 answers

Not sure if you meant a GUI button or Part with a ClickDetector

Click Detector If you want to use a ClickDetector then you should make a model put the script inside there and put the the part in there with the ClickDetector. It might have been your directory. You should then insert this into the script. (You must use a regular script for this to work.)

script.Parent.Button.ClickDetector.MouseClick:connect(function(Player)
print("Activated")
end)

GUI TextButton If you wanted to use a GUI button your event should be.

script.Parent.TextButton.MouseButton1Down:connect(function(Player)
print("Activated")
end

Text buttons do NOT use .MouseClick For a full list of the events that can be used please refer to the ROBLOX wiki page. http://wiki.roblox.com/index.php?title=TextButton

If you need any more help please contact me

4 comments

0

Its not a text button... And My Directory isn't wrong, it is a server script.

0

Ok try using this then: function onClicked() print("Activated") end script.Parent.Button.ClickDetector.MouseClick:connect(onClicked)

0

Nope :( Don't Work.

0

Does it help to mention I moved the game from my game to a group game?

You do realize there is something called a "TextButton" in ROBLOX for a reason right? XD

1 comment

0

? Ok? And?

This discussion is preserved as it was. New answers, comments, and votes are closed.