I’m currently trying to make a script where once a player carries a car, a part will become transparent and allow them to see under it. I’m using RemoteEvent, however, to only allow the player carrying the car to see under. But after some research and tutorials, I just can’t figure out how to make the local script which should fire the function to the client only to work. Here are both scripts–
Server Script:
local anim = script.Animation
local Car = script.Parent.Parent.Car
local debounce = nil
script.Parent.Touched:Connect(function(hit)
print(hit)
local Car2 = Car:Clone()
Car2.Parent = Car.Parent
local humanoid = hit.Parent.Humanoid
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local animTrack = humanoid:LoadAnimation(anim)
local re = game:GetService("ReplicatedStorage")
local Film = script.Parent.Parent:FindFirstChild("Film")
--code to make the player carry car
if humanoid then
re.RemoteEvent:FireClient(player, Film)
end
end)
Local script (located in StarterPlayerScripts)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local PartsIncluded = ReplicatedStorage:WaitForChild("RemoteEvent")
local function Show(player, Film)
print(Film)
Film.Transparency = 1
end
PartsIncluded.OnClientEvent:Connect(function()
Show()
end)