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

I made a script thats a thing will be visible when i pressed a key but other players cant see ??

Asked by 4 years ago

hi, i made a script thats the bird model will be visible if i pressed z key its working with me only other players can't see anything i made a remote event and i said fire server and not working

repstorage = game:GetService("ReplicatedStorage")
RemoteEvent = repstorage:WaitForChild("Bird")
local bird = game.Players.LocalPlayer.Character.Shouldercrow.Handle
local player = game.Players.LocalPlayer
local havebird = game.Players.LocalPlayer.bool.HaveBird
local character = player.Character

game:GetService("UserInputService").InputBegan:Connect(function(input, GameStuff)
    if GameStuff then return end
    if input.KeyCode == Enum.KeyCode.R and havebird.Value == 1 then
        bird.Transparency = 0
        RemoteEvent:FireServer()
    end
end)
0
Make sure it is in localscript JesseSong 3916 — 4y
0
its a local script and its in starterCharacterscripts TheGreenGaming886 2 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago

you need to change the transparancy from the server side, Firing the server only tells the server to carry out an instruction that the client wants to replicate, the server doesn't automatiically know waht the client wants, so you have to listen for OnClientEvent on the remote event, and Change the transparency there...

0
hi i made what you say TheGreenGaming886 2 — 4y
0
see my answer TheGreenGaming886 2 — 4y
0
you need to do `game.ReplicatedStorage.Bird.OnClientEvent:Connect(function)` from the server User#23252 26 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

but its not working its says 22:54:19.245 - Attempt to connect failed: Passed value is not a function please tell me what should i say in that case

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local bird = game.Players.LocalPlayer.Character.Shouldercrow.Handle
local player = game.Players.LocalPlayer
local havebird = game.Players.LocalPlayer.bool.HaveBird
local character = player.Character

game:GetService("UserInputService").InputBegan:Connect(function(input)
    if input.KeyCode == Enum.KeyCode.R and havebird.Value == 1 then
        bird.Transparency = 0
    end
    game.ReplicatedStorage.Bird.OnClientEvent:Connect(input)
end)

Answer this question