So this script only works for one player, having only one variable meaning that one player can hover with mouse over and the other person doesnt have to do it. I can't use localscripts as this is ProximityPrompt. Any way I can do this?
Part of Script:
local isHovering = false script.Parent.ClickDetector.MouseHoverEnter:Connect(function() isHovering = true end) script.Parent.ClickDetector.MouseHoverLeave:Connect(function() isHovering = false end) script.Parent.ProximityPrompt.PromptButtonHoldBegan:Connect(function(plr) if isHovering == true then local value = plr.PlayerGui.PickupCircle.ArcBar.CBar.Fill.Value plr.PlayerGui.PickupCircle.ArcBar.Visible = true Tween = ts:Create(value,Info,Goal) Tween:Play() end end)
I recommend you use an _G value (Global) like so:
_G.isHovering = false script.Parent.ClickDetector.MouseHoverEnter:Connect(function() _G.isHovering = true end) script.Parent.ClickDetector.MouseHoverLeave:Connect(function() _G.isHovering = false end) script.Parent.ProximityPrompt.PromptButtonHoldBegan:Connect(function(plr) if _G.isHovering == true then local value = plr.PlayerGui.PickupCircle.ArcBar.CBar.Fill.Value plr.PlayerGui.PickupCircle.ArcBar.Visible = true Tween = ts:Create(value,Info,Goal) Tween:Play() end end)
Keep in mind you will have to rename the part after "_G." for each script so that you don't accidentally set two parts at the same time. More here.
Found the solution. Create a stringvalue for each player that you can change to know if the mouse is hovering over part.
This is the script:
local ts = game:GetService("TweenService") local Info = TweenInfo.new(1,Enum.EasingStyle.Cubic,Enum.EasingDirection.In,0,false,0) local Goal = {Value = 38} local Tween local isHoveringVal game.Players.PlayerAdded:Connect(function(plr) isHoveringVal = Instance.new("StringValue") isHoveringVal.Name = "Hover" isHoveringVal.Parent = plr isHoveringVal.Value = "NotHovering" end) script.Parent.ClickDetector.MouseHoverEnter:Connect(function(plr) isHoveringVal.Value = "Hovering" end) script.Parent.ClickDetector.MouseHoverLeave:Connect(function(plr) isHoveringVal.Value = "NotHovering" end) script.Parent.ProximityPrompt.PromptButtonHoldBegan:Connect(function(plr) if isHoveringVal.Value == "Hovering" then local value = plr.PlayerGui.PickupCircle.ArcBar.CBar.Fill.Value plr.PlayerGui.PickupCircle.ArcBar.Visible = true Tween = ts:Create(value,Info,Goal) Tween:Play() end end) script.Parent.ProximityPrompt.PromptButtonHoldEnded:Connect(function(plr) local value = plr.PlayerGui.PickupCircle.ArcBar.CBar.Fill.Value plr.PlayerGui.PickupCircle.ArcBar.Visible = false Tween:Pause() value.Value = 1 end) script.Parent.ProximityPrompt.Triggered:Connect(function(plr) script.Parent:Destroy() end)