Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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)

2 comments

0

Make sure it is in localscript

0

its a local script and its in starterCharacterscripts

2 answers

✓ Accepted answer

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...

3 comments

0

hi i made what you say

0

see my answer

0

you need to do game.ReplicatedStorage.Bird.OnClientEvent:Connect(function) from the server

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.