Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is this failing to get a playermouse?

Asked by
3rdblox 30
10 years ago
for _,v in pairs(game.Players:GetChildren()) do
        thing = script.AnnounceGui:clone()
        thing.Frame.Position = UDim2.new(v:GetMouse().ViewSizeX/200,0,v:GetMouse().ViewSizeY/200,0)
        thing.Parent = v.PlayerGui
    end

It threw an error saying it couldn't index a nil value with v:GetMouse. But I'm definately talking about players with v because I'm iterating through the players. Why is this going wrong?

1 answer

Log in to vote
1
Answered by 10 years ago

:GetMouse() only works from a localscript, and it will only get the mouse of the player that the script is in

Ad

Answer this question