Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Server Side
- local Collection = game:GetService("CollectionService")
- local rep = game:GetService("ReplicatedStorage")
- for i,v in Collection:GetTagged("Interactive Models") do
- if v:GetAttribute("Text") then
- local ClickDetector = Instance.new("ClickDetector")
- ClickDetector.MaxActivationDistance = 9
- ClickDetector.Parent = v
- ClickDetector.MouseHoverEnter:Connect(function(player)
- rep.InteractiveRemote:FireClient(player, v, "Enter")
- end)
- ClickDetector.MouseHoverLeave:Connect(function(player)
- rep.InteractiveRemote:FireClient(player, v, "Leave")
- end)
- end
- end
- --------------------------------------------------------------------------------------------------------
- --Client Side
- local rep = game:GetService("ReplicatedStorage")
- local gui = script.Parent.InteractiveGui
- local tween = game:GetService('TweenService')
- local Dissapear = tween:Create(gui.Text, TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextTransparency = 1})
- local Appear = tween:Create(gui.Text, TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextTransparency = 0})
- gui:WaitForChild("Text").TextTransparency = 1
- rep.InteractiveRemote.OnClientEvent:Connect(function(v: Part, Status)
- if Status == "Leave" then
- if v:FindFirstChildWhichIsA("Highlight") then
- local DissapearHighLight: Tween = tween:Create(v.Highlight, TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {OutlineTransparency = 1})
- DissapearHighLight:Play()
- Dissapear:Play()
- task.delay(1,function()
- v.Highlight:Destroy()
- end)
- end
- elseif Status == "Enter" then
- local highlight = Instance.new("Highlight")
- highlight.FillColor = Color3.fromRGB(255,255,255)
- highlight.FillTransparency = 1
- highlight.OutlineTransparency = 0.4
- highlight.Parent = v
- local DissapearHighLight = tween:Create(v.Highlight, TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {OutlineTransparency = 0}):Play()
- gui.Text.Text = v:GetAttribute("Text")
- Appear:Play()
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement