local Plr = game:GetService("Players").LocalPlayer
local Mouse = Plr:GetMouse()

while wait() do
    if Mouse.Target.Name == "Human" then
        script.Parent.Human.Head.Sound:Play()
    end
end

Script location: StarterPack Script type: Server Script

I'm trying to get this to work server-side but it seems this only works when it is a localscript. Any ideas on how to get this to work?

4 comments

0

The mouse object is only client side, what exactly do you want to do with the mouse?

0

Sorry for being vague, I wanted to trigger an event where when someone looks at a part, it triggers server-side. Sorry if this if this comment is vague. Thanks for letting me know that tho!

0

Do the "looking at part" check in the client, then let the server know through a RemoteEvent.

0

@strongrussianboy123 thank you! I will try that.