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

how to fire a remote event if player touched an npc?

Asked by 4 years ago
Edited 4 years ago

Please encode Lua code in the Lua block code tag (look for the Lua icon in the editor).

i need help. im trying to fire the remote event if player touched an npc. i dont know whats wrong with it


local Camera = game.Workspace.CurrentCamera
local Player = game.Players.LocalPlayer


local function onTouch(hit)
    game.ReplicatedStorage.ChangeChar:FireServer(game.ReplicatedStorage.Dummy)
    Camera.CameraType = "Custom"
            if Player.Character and Player.Character:FindFirstChild("Torso") then
                Player.Character.Torso.CFrame = CFrame.new(-24.392, 2, -6.694)
                Player:SetPrimaryPartCFrame(-24.392, 2, -6.694)
    end 
end

script.Parent.Touched:Connect(onTouch)

Answer this question