I am making a script that changes the player model whenever they touch a certain part. How would I make it only happen to the player that touches the part? Right now it just happens to a random person.
local script (attached to part)
script.Parent.Touched:Connect(function() local plr = game.Players.LocalPlayer local camera = workspace.CurrentCamera local rig = game.Workspace.TheBeast camera.CameraType = "Follow" camera.CameraSubject = rig.Head script.Parent.RemoteEvent:FireServer() end)
Issue: I want to turn a player character, "beast", into a character model. I'm not sure if you need this to resolve the issue but just in case.
Main Script
local dontrepeat local beast = math.random[1,game.players:GetChildren] script.Parent.RemoteEvent.OnServerEvent:Connect(function(plr) local char = plr.Character local rig = game.Workspace.TheBeast --the model you want to turn into-- if not rig.HumanoidRootPart:FindFirstChild("DontRepeat") then plr.Character = rig end wait() if not rig.HumanoidRootPart:FindFirstChild("DontRepeat") then dontrepeat = Instance.new("Attachment") dontrepeat.Name = "DontRepeat" dontrepeat.Parent = rig.HumanoidRootPart wait() char:Destroy() end end)