So, I am trying to make am attempting to make a police radar system, I am using an A-Chassis Vehicle and I created a string value inside of the car that showcases the current speed of the car.
and I have an invisible block that when touched by the other car gets the value of the other car it is touching, It only shows the default value and not the changed value… I was thinking that it’s not working because the string value is only changing on the client. I attempted to use a remote event but I confused myself. I got rid of the remote event stuff and this is what the script that was inside the block being touched.
if hit:FindFirstChild("SpeedValue") then
while true do
And this is the script that tells the speed value to change with the cars speed value
it was a local script placed inside of the Speed Textbutton that gets cloned into the players gui.
if script.Parent.Parent.Parent.Parent == game.Players.LocalPlayer.PlayerGui then
local carvalue = script.Parent.Parent.Parent.Car.Value
while true do
carvalue.DriveSeat.SpeedValue.Value = script.Parent.Text
I’m almost 90% sure I need a remote event, if it is please help me. I really confused myself hard…
Just for context, are they both scripts?
Yes these are both 2 different scripts.
So which ones which? Like which is the localscript?
The Speed TextLabel has a local script and the part that detects cars has a script.
So in this case, you will need to fire a remote event from the localscript to get ahold of the script.
This is unwise. Now, every time the script.Parent is touched, it’ll start a new loop. Touched can fire many times, so you’ll probably crash the game. If you want to get a changing value, you could do
local function printSpeed(value)
It sounds like to me that you may not realise that local script inputs are filtered out from the workspace. In other words changes to any instance that is under the workspace (excluding player ownership Baseparts and characters) will not be detected on a regular script.
To fix this you either should read the A Chassis docs (if there is one) to find out how speed is calculated or you can use a different measurement of speed. Such as
local Speed = Car.PrimaryPart.AssemblyLinearVelocity.Magnitude
(A model car with a primary part is required. Measurement in studs per sec.)
Yikes. I would not recommend doing that getting information from client GUI is risky.
What I would do is to find out another way you can directly retrieve the speed of the car through the server script only.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.