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

Spectate Button to spectate tool. Help?

Asked by 5 years ago

So I am kind of confused on these scripts.

This one is inside the textbutton

local replicatedstorage = game:GetService("ReplicatedStorage")
script.Parent.MouseButton1Click:Connect(function()
    replicatedstorage.FireServer:FireServer()
end)

this is the server script

game.ReplicatedStorage.FireServer.OnServerEvent:Connect(function(player)
    game.ReplicatedStorage.FireClient:FireClient(player)
end)

other local script

local cam = game.Workspace.CurrentCamera
local player = game.Players.LocalPlayer

game.ReplicatedStorage.FireClient.OnClientEvent:Connect(function()
    if  player.Backpack:WaitForChild("Tool") then
        cam.CameraSubject = player.Backpack.Tool.Handle
        cam.CameraType = "Follow"
    elseif game.Workspace:WaitForChild("Tool") then
        cam.CameraSubject = game.Workspace.Tool.Handle
        cam.CameraType = "Follow"
    elseif player.Character:WaitForChild("Tool") then
        cam.CameraSubject = player.Character.Tool.Handle
        cam.CameraType = "Follow"
    end
end)

Doesn't work at all :(

0
ok but why are you firing the server which fires the client cant you just do all these without events from the 1st localscript, also please post output if there is any radusavin366 617 — 5y
0
Let me explain I want it to that when a player clicks gui it can spectate ANY TOOL whether its in another players backpack or workspace. And there is no output WillBe_Stoped 71 — 5y
0
since only the client can only see his/her screen only, you don't have to use a remote event to do this. hellmatic 1523 — 5y
0
oof can you help me out I've tried this before. When the Tool was in the workspace it would work also if it was in the localplayers backpack then itll work. However If it was in another players backpack then it would not work at all add me on discord (willbe_stoped#8788) WillBe_Stoped 71 — 5y

Answer this question