Search
 
SCRIPT & CODE EXAMPLE
 

TYPESCRIPT

remote events client to server lua

-- Example on creating a part. Using Remote Events
-- Client - Server.

-- (Local Script) Fire Remote Event

    local ReplicatedStorage = game:GetService("ReplicatedStorage")
     
    local remoteEvent = ReplicatedStorage:WaitForChild("RemoteEventTest")
     
    -- Fire the remote event
    remoteEvent:FireServer()
    
    -- Include additional data when firing the event
    -- Like passing Color and Position to Server
    
    -- remoteEvent:FireServer(BrickColor.Red(), Vector3.new(0, 25, 0)) --

-- (Script) Create Part on Server
	local ReplicatedStorage = game:GetService("ReplicatedStorage")
     
    --Get removeEvent from the ReplicatedStorage
    local remoteEvent = ReplicatedStorage:WaitForChild("RemoteEventTest")
     
    -- Create a new part
    local function onCreatePart(player, partColor, partPos)
    	print(player.Name .. " fired the remote event")
    	local newPart = Instance.new("Part")
        
        -- Use attributes you passed on
    	newPart.BrickColor = partColor
    	newPart.Position = partPos
    	newPart.Parent = workspace
    end
     
    -- Call "onCreatePart()" when the client fires the remote event
    remoteEvent.OnServerEvent:Connect(onCreatePart)
Comment

PREVIOUS NEXT
Code Example
Typescript :: What were four effects of the War of 1812? 
Typescript :: how do i remove the brackets around a list in python 
Typescript :: union of two sets python syntax 
Typescript :: angular typescript set meta data 
Typescript :: how to make comments in .env files 
Typescript :: on select date matpicker angular 
Typescript :: no provider for childrenoutletcontexts angular 
Typescript :: ionic 5 formarray 
Typescript :: how to send data between components in react using link 
Typescript :: get documents path c# 
Typescript :: typescript foreach 
Typescript :: how to remove duplcates elements from arraylist 
Typescript :: vue router get full string query 
Typescript :: angular convert boolean to string 
Typescript :: ggplots in r 
Typescript :: check if document exists mongodb python 
Typescript :: Implement a function that accepts 3 integer values a, b, c. The function should return true if a triangle can be built with the sides of given length and false in any other case. 
Typescript :: regular expression starts and ends with same symbol 
Typescript :: angular send mailto html 
Typescript :: window typescript 
Typescript :: create react project in typescript 
Typescript :: pandas value_counts sort descending 
Typescript :: google sheets reference cell static 
Typescript :: benefits of linux 
Typescript :: count number of set bits in number java 
Typescript :: typescript array of react elements 
Typescript :: router configuration vue 
Typescript :: if exits python sql 
Typescript :: adding two lists using lambda function 
Typescript :: pandas value_counts multiple columns 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =