Im making it so when a part is touched it fires a remote event that then fires a local script that tweens a door open however I keep getting this error anyone know why?
ServerScript
LocalScript
Im making it so when a part is touched it fires a remote event that then fires a local script that tweens a door open however I keep getting this error anyone know why?
ServerScript
LocalScript
FireClient()
accepts one parameter minimum, and that is the player object you are trying to fire to.
Try changing your server script (I also helped to optimise it a bit):
local players = game:GetService("Players")
local rStorage = game:GetService("ReplicatedStorage")
local event = rStorage.RemoteEvent
local detector = script.Parent
local db = false
local function processTouch(hit)
if db then return nil end
local player = players:GetPlayerFromCharacter(hit.Parent)
if player then
db = true
event:FireClient(player)
task.wait(0.5)
db = false
end
end
detector.Touched:Connect(processTouch)
Also, please avoid sending code screenshots, just format like I did above - it makes it a lot easier and nicer to read. You can do this by pressing the ‘</>’ button on your post editor or by putting backticks (`) either side of it .
Thank you for the help but I’d like to ask why you have included db could the script not just run fine without it?
I included db
(short for debounce) because it acts as a cooldown. Basically, I put it in to stop the event firing every time you moved on the part (preventing rapid-fire of the event).
Well I used the code and the error is gone, but now It’s not working and I’m getting no error message.
You created the variable TweenInfo
, which overrides the variable to create a TweenInfo
object. Change that variable name to something else, e.g. info
.
I’m getting no error message but it still wont work
Do {CFrame = targetCFrameHere}
when making the tween.
Wdym by "When making it a tween. Like make it a variable?
When using TweenService:Create()
, on the third parameter where you pass a table of properties to be tweened, you have just put CFrame.new()
with no guidance on what property it should be applied to. You need to do {CFrame = CFrame.new()}
.
Also, CFrame.new()
accepts 3 Vector3
items, not three numbers.
you never specified which client to fire