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

Click detector local event not running?

I am trying to make it some when you hover over a part it's bilboard gui highlight (by setting text stroke transparency = 0). But when I did

local ts = game:GetService("TweenService")

local linear_bi = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)

script.Parent.MouseHoverEnter:Connect(function(plr)
	local tween = ts:Create(script.Parent.Parent.BeforeHead.TextLabel, linear_bi, {
		TextStrokeTransparency = 0
	})
	tween:Play()
end)

script.Parent.MouseHoverLeave:Connect(function(plr)
	local tween = ts:Create(script.Parent.Parent.BeforeHead.TextLabel, linear_bi, {
		TextStrokeTransparency = 1
	})
	tween:Play()
end)

Then I looked for other questions on here and got the idea of using RemoteEvent on the server and firing the client. However when I did this it didn't work. SERVER

script.Parent.MouseClick:Connect(function()
	script.Parent.Parent.Parent.Health.Value = script.Parent.Parent.Parent.Health.Value - 1
end)

script.Parent.MouseHoverEnter:Connect(function(plr)
	script.Parent.Enter:FireClient(plr)
end)

script.Parent.MouseHoverLeave:Connect(function(plr)
	script.Parent.Leave:FireClient(plr)
end)

CLIENT

local ts = game:GetService("TweenService")

local linear_bi = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)

script.Parent.Enter.OnClientEvent:Connect(function(plr)
	print("Enter CLIENT")
	local tween = ts:Create(script.Parent.Parent.BeforeHead.TextLabel, linear_bi, {
		TextStrokeTransparency = 0
	})
	tween:Play()
end)

script.Parent.Leave.OnClientEvent:Connect(function(plr)
	local tween = ts:Create(script.Parent.Parent.BeforeHead.TextLabel, linear_bi, {
		TextStrokeTransparency = 1
	})
	tween:Play()
end)

Thank you!

1 answer

Make a Local Script in the StarterGui instead of using local script into the main Model

Example:

--StarterGui Script

Local ClickDetect = game.Workspace.Part.ClickDetector

ClickDetect.MouseClick:Connect(function()
--Do Something
end

4 comments

0

This did not work :(

0

topsgaming did you just copy the code from here or turned your script into a local script?

0

No I didn't copy the code, and I didn't just change a script into a local script. I took his idea and wrote code around that. I put a local script inside of the gui I want to animate and It still does not work.

0

Only startergui not on screengui.

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