Answered by
5 years ago Edited 5 years ago
Unfortunately it seems that the Touched
event wont fire on clients, but the server. You can bypass this by using RemoteEvents
.
In LocalScript:
1 | game.ReplicatedStorage.REMOTEEVENT.OnClientEvent:Connect( function () |
2 | local camera = workspace.CurrentCamera |
3 | camera.CameraType = Enum.CameraType.Scriptable |
4 | camera.CFrame = workspace.Camera 1. CFrame |
In Server script:
1 | script.Parent.Touched:connect( function (h) |
2 | if h.Parent:FindFirstChild( "Humanoid" ) then |
3 | game.ReplicatedStorage.REMOTEEVENT:FireClient(game.Players:FindFirstChild(h.Parent.Name)) |
You can replace REMOTEEVENT with whatever you want the RemoteEvent
to be called, just make sure there is a RemoteEvent
in ReplicatedStorage
with the same name.
Hope this helps!